Hey,
For my dataset I have 20+ years of data with 19 unique countries per year
I want to create 1 column where every country gets its own dummy number, without typing everything out like so:
generate countrydummy = 0
replace countrydummy =1 if Country == " Austria"
replace countrydummy =2 if Country == "Belgium"
etc..
Is there a way to efficiently create a dummy for every country? (I do not want to use: tabulate Country, generate(countrydummy) because I will get 19 columns.. )
Related Posts with Creating dummy for unique value
create a variable for the second lowest valueI have a list of values (bids). I already have generated the minimum value via: Code: egen minbid…
Instrumental variables for Stata's -reg3- in 3SLS modelsHi, I am dealing with an econometric modeling issue which is new to me. While I have used 2SLS and …
Cross-classified growth modelI have data of about 2000 children, with measures taken across 4 timepoints over the span of two yea…
forvalues with skipped valuesI have about 300 items for which I want to run the forvalues loop. However, I need to skip about 6 v…
Dummy variables for table values for percentileHey guys, I want to create one dummy variable which assigns a value of 1 for values above 90 percen…
Subscribe to:
Post Comments (Atom)
0 Response to Creating dummy for unique value
Post a Comment