Dear Statalisters,
I work on a database in which results of an enterprise survey (multiple choice questions) are collapsed into the sum of options chosen by the respondents within an enterprise. Example: In first row, within firm “A”, 9 respondents chose opt1; 7 chose opt2; and 8 chose opt3.
clear
input str6 firm_id byte (opt1 opt2 opt3)
"A" 9 7 8
"B" 15 5 8
"C" 3 6 3
"D" 4 3 3
"E" 10 6 2
What I need is to disaggregate each total into single records. My code is:
expand opt1 if firm_id=="A"
replace opt1=1 if firm_id=="A"
Maybe there is a better way to do it. Also, I need to create a loop with foreach over 220 variables and 500 enterprises.
Thank you,
Iciar Pavez
Related Posts with Expanding observations
Negative Binomial regressionI have number of children as count variable which I am regressing on the log of parent's income. How…
ARDL short run coefficientDear community, I am coming back to you because I have a small problem concerning the estimation of…
Regress data with multiple imputation using micombineDear stata-community, we are working on a regression model using SCF-data (https://www.federalreser…
generate a new variable (average over every two years)Dear StataList-ers! Help! I need somebody! My question is very basic. Panel data (countries, years…
Interpreting the marginal effect in Probit with a logged transformed covariateHi everyone, I have a challenge with interpreting the marginal effect in Probit model with a logge…
Subscribe to:
Post Comments (Atom)
0 Response to Expanding observations
Post a Comment