Hello Stata Community.
I'm working in my master thesis with a data base about middle class, their values and political perceptions for 24 Latin American countries. I'll focus on 2012, 2014 and 2016 waves. So, my explained variable is a categorical one (0=lower classe ; 1=middle class and 2=upper class). To run the model I have created this variable for each country and year. The problem is that i have to "isolate" the middle class in one variable, and that's relatively easy by hand with "gen" command, but I think there is an easier way than doing it one by one (or not). So, i want to run a loop which take every categorical income variable and split it in 3 different variables (LW_10_90_2012=lower classe ; MC_10_90_2012=middle class and UC_10_90_2012=upper class as an example). Here the list of variables for 2012 (there're the same variables for 2014 and 2016). Is it possible to do this process by using a loop or is it better to do it one by one?
Thank you so much!!!
per_10_90_Total_q10g_12
per_10_90_Mexico_q10g_12
per_10_90_Guatemala_q10g_12
per_10_90_Salvador_q10g_12
per_10_90_Honduras_q10g_12
per_10_90_Nicaragua_q10g_12
per_10_90_CostaRica_q10g_12
per_10_90_Panama_q10g_12
per_10_90_Colombia_q10g_12
per_10_90_Ecuador_q10g_12
per_10_90_Bolivia_q10g_12
per_10_90_Peru_q10g_12
per_10_90_Paraguay_q10g_12
per_10_90_Chile_q10g_12
per_10_90_Uruguay_q10g_12
per_10_90_Brasil_q10g_12
per_10_90_Venezuela_q10g_12
per_10_90_Argentina_q10g_12
per_10_90_RD_q10g_12
per_10_90_Haiti_q10g_12
per_10_90_Jamaica_q10g_12
per_10_90_Guyana_q10g_12
per_10_90_TriniT_q10g_12
per_10_90_Belice_q10g_12
per_10_90_Surinam_q10g_12
Related Posts with Problems with a loop to generate new variables
Cumulative frequencies and names of observations calculated across rows of different variablesHi Statalisters, Could someone help me with the below or direct me to any previous thread (which I …
Merging two datasets within the interval of datesDear Stata Users, This post relates to the previous one, I was not clear enough on that. I need to …
logit model yield too high coefficientI ran a logit model Code: egen Banks=group(V) [/CODE] logit Collateraldummy Age Numberofemployee…
Multivariate GARCH models - help needed with implementation and interpretationFor a research project, I'm investigating the connectedness between major financial markets from an …
Demand elasticityHi all, I am using stata to estimate demand for automobiles. I have panel data of 4 years 2014-2017…
Subscribe to:
Post Comments (Atom)
0 Response to Problems with a loop to generate new variables
Post a Comment