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
Probit marginal effectsI estimated the following probit model: Code: probit enrolled i.male##c.wealth i.male##c.oppcost h…
New version of -ranktest- available on SSCWith thanks to Kit Baum, a new version of ranktest by Kleibergen-Schaffer-Windmeijer, version 2.0.03…
Problem encoding dates: unordered valueHi all: I am gettings problems when I encode a date variable, to explain my problem I will use this…
Difference between vce(cluster) and vce(bootstrap)?I'm using a fixed effects model. When dealing with heteroscedasticity and autocorrelation, I'm not s…
Merge two datasets wih the same variable namesHi there, I have several datasets, each with the prediction error of different forecast models. I w…
Subscribe to:
Post Comments (Atom)
0 Response to generate varialbe on the condition
Post a Comment