Hi guys,
I am a Stata beginner and have a problem in generating a dummy called aggregate.
I tried it with inlist(), but as my list is very long I get an error message "Expression too long".
This is my code:
#delimit ;
gen aggregate = inlist(countryname,"Arab World", "Caribbean small states",
"Central Europe and the Baltics",
"East Asia & Pacific (all income levels)",
"East Asia & Pacific (developing only)",
"Euro area", "Europe & Central Asia (all income levels)",
"Europe & Central Asia (developing only)",
"Europe and Central Asia (IFC classification)",
"European Union", "Fragile and conflict affected situations",
"Heavily indebted poor countries (HIPC)",
"High income", "High income: nonOECD", "High income: OECD",
"Latin America & Caribbean (all income levels)",
"Latin America & Caribbean (developing only)",
"Latin America and the Caribbean (IFC classification)",
"Least developed countries: UN classification",
"Low & middle income", "Low income", "Lower middle income",
"Middle East & North Africa (all income levels)",
"Middle East & North Africa (developing only)",
"Middle income", "North America", "OECD members",
"Other small states", "Pacific island small states",
"Small states", "South Asia",
"Sub-Saharan Africa (all income levels)",
"Sub-Saharan Africa (developing only)",
"Upper middle income", "World"
),;
#delimit cr
Is there any smarter way to do that?
Related Posts with Inlist Expression too long
Only Keeping Children if Their Parents are in the SurveyHi All, I am trying to make a child file where I only keep observations of those children who have …
Desingplot without showing the missing valuesSuppose i have the following data in which the variables have some missing values. I want to show th…
Reshape long to wideHello, Here is the data that I want to reshape to wide format, my sample is around 7.5 million obse…
Plotting moderating effects: 1. Margin plots empty output issue; 2. Solutions for 3-way margin plots with c. and i.Dear Stata experts, please help me to find a mistake in my code. It worked fine just 3 days ago but…
Trend analysisIf we have following data, which includes rates in each age group with corresponding 95%CI and stand…
Subscribe to:
Post Comments (Atom)
0 Response to Inlist Expression too long
Post a Comment