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!
0 Response to Convert categorical variable to dummy variables in a large dataset
Post a Comment