I have a question which is very basic which I couldn't do it myself, hence seeking the help of members
Code:
input str1 firm float (profits) int year "a" 100 1999 "a" . 2000 "a" . 2001 "a" 200 2002 "b" 500 1999 "b" 800 2000 "b" 1000 2001 "b" 200 2002 "c" . 1999 "c" . 2000 "c" . 2001 "c" 200 2002 end
HTML Code:
https://www.stata.com/support/faqs/data-management/identifying-runs-of-consecutive-observations/
I tried the following basic codes
Code:
encode firm,gen(id) xtset id year gen dummy=. replace dummy=1 if !missing(profits) & ?
0 Response to Generating dummy based on the condition of minimum number of observations of a variable
Post a Comment