Hi all,
If I have data of 100 firms for 10 years with three variables; and I want to make a dummy variable equal to 1 for the firm if the value of variable x1 in year1 or year2 or year3 not equal to zero; how do I do it?
Probably I need something like: by id, gen boom=1 if x12000 !=0 | x12001 !=0 | x12002 !=0, but obviously there is no variable x!2000 etc. Thank you for your help.
Abdan
Related Posts with Creating dummy based on variable value in subset year
How to draw a correlation forest map with the admetan command?Dear Statalist, I have recently done a meta-analysis of the correlation coefficient, but I encounter…
foreach- reorganising multiple variablesHi, I am new to STATA and I am struggling to reorganise a large dataset using loops. Each id repre…
Unbalanced panel data analysisHi dear all i hope you all fine ...i am undergoing a problem in running analysis on the data ,the de…
GLM or Tobit Regression & Forecast for different distributions (incl. zero inflation)Dear Statalists, I'd very much like to hear your opinion on the following. What I’m trying to do: …
Using atcontrasts in margins for a mixed effect modelHi everyone I am currently working on a project (using Stata 15) to analyse changes in kidney funct…
Subscribe to:
Post Comments (Atom)
0 Response to Creating dummy based on variable value in subset year
Post a Comment