Hi ,
I want to generate the variable only up the condition of another variable
here,
local 38"phone"
local 39"Battery"
local 40"machine spare parts"
local 41"carpenter tools"
local 42"horse"
local 43"sound-box"
local 44"bamboo and"
local 45"box"
local 46"cement,zinc sheet"
local 47"chain saw"
local 48"motor"
local 49"water tank"
local 50"Tree"
forval n=38/50{
gen agriitem_pur_`n'=0 if itemoth1=="``n''"
}
Searching about local text, if there is that local text, want to generate that local number in agriitem_pur_`n'. If not, no need to generate, for example, if motor in itemoth1, generate agriitem_pur_38, otherwise, not need to generate that variable. But now generate all variable whether not find the local item.
Please sugest!
Related Posts with generate varialbe on the condition
Matrix raised to a certain powerHi all, I am new to mata and have a question related to matrix manipulation in MATA. I have: A = (…
How to get fiited value of trade with ppmlhdfe?Hello, I have a model like this: ppmlhdfe v.d. v.i., absorb (orig_year dest_year) cluster (origin d…
mtitles for titles and sub-titles within estab commandHi, I want to export a summary statistics table into Latex that is conditional on more than one var…
Regression outputHi all, I'm running a series of regression with industry and year fixed effect My dependent variabl…
Start counter counting missing values after each non-missing valueHi, I would like to start counter counting missing values after each non-missing value by group (un…
Subscribe to:
Post Comments (Atom)
0 Response to generate varialbe on the condition
Post a Comment