Dear everyone,
I have a dataset of 350 categorical variables, e.g: How satisfied are you with your life? 1. Unhappy .... 10. Very happy.
I want to do regression on them, but my professor advised me to convert them into dummy variables before doing it.
However, I only know one command to convert 1 categorical variable to dummy variable: tabulate varname, gen(newvarname). How could I convert such a large number of variables to dummy at once?
I also tried loop with foreach, but It was not correct.
Could you please kindly advised me?
Thank you very much!
Related Posts with Convert categorical variable to dummy variables in a large dataset
Is there an 'or' function when coding variables?I am coding a binary variable (done) to denote if a diagnostic test was done, 1=yes, 0=no. I want i…
Change of stationarity when transforming from daily to yearly valuesHi everyone, I have a variable with daily observations that is stationary according to dickey fulle…
Difference between variables' foreach loop regression coefficientsDear STATA users, I am using a foreach loop to regress four models across multiple variables. I nee…
Duplicating previous year data Code: +----------------------------------------+ | country year dbagdp pcrdbgd…
Comparing 3 correlation coefficientsI have a group of about 1300 patients who had had disease 1 (subgroup 1), disease 2 (subgroup 2), or…
Subscribe to:
Post Comments (Atom)
0 Response to Convert categorical variable to dummy variables in a large dataset
Post a Comment