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
Contour plot cannot handle missing xHi all, As you can see from my code below, I only want to plot the cells with F statistics higher t…
subsetByVIF -- An ado file that selects a subset of covariates constrained by variance inflation factors (VIFs)subsetByVIF selects subsets of the covariates such that each covariate in a given subset has a VIF t…
Choosing the right modeling technique available in STATADear Stata Experts: I am working on an assignment to predict state policy on a particular issue. Th…
subsetByVIF -- An ado file that selects a subset of covariates constrained by variance inflation factors (VIFs)subsetByVIF selects subsets of the covariates such that each covariate in a given subset has a VIF t…
Error calculating marginal effects with a tobit modelI am looking at the effect of permitting standards, rebates, average income, and electricity price o…
Subscribe to:
Post Comments (Atom)
0 Response to Problems with a loop to generate new variables
Post a Comment