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
How to create a categorical variable from a list?Hello members, I would like to seek your suggestion please on how best I can create a categorical v…
Multinomial logit models and vce(cluster) option. How to study the within group varianceDear stata users, I am utilizing a a cross sectional dataset and a multinomial logit model (MNL) to…
Problem with correcting a heteroskedasticity and serial correlation on panel data with fixed effectHello Statalists, I have a balanced panel data of 131 countries over 20 years with fixed effect (us…
Results of Logistic RegressionHi there, I tried to run a logistic regression, but it seems that my results does not seem to be cor…
Which test for between multiple groups and frequencies?Hi all, I am looking at frequencies (how many people said yes or no to a question) and would like t…
Subscribe to:
Post Comments (Atom)
0 Response to Problems with a loop to generate new variables
Post a Comment