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
Hausman Test for FE and REHi, I have a question, if my Hausman test is like below, which model should I use? Is it FE or RE? …
Using a Matrix to Identify AnaemiaThis started as a question, but I came up with a solution that I couldn't find documented elsewhere.…
Replacing the nth word of a stringHi All, I am trying to replace the nth word of a string and i am struggling to find an efficient wa…
regressions with Newey–West standard errors for a list of countriesI have a panel-data and I use ‘asreg’ or ‘rangestat’ to estimate a regression for each country separ…
Testing Equality of Gini Coefficients when samples are dependentHello all, I am trying to test if two Gini coefficients are statistically significantly different b…
Subscribe to:
Post Comments (Atom)
0 Response to generate varialbe on the condition
Post a Comment