I downloaded data from eurostat using eurostatuse code and want to generate shares of people in education and then want to generate an education index (this second part is straightforward, I can do it)
The issue is, to create shares, I need a column with totals and I am unable to have the column filled and I have to copy paste the two lines of fill multiple times. How do I create shares of people in secondary and tertiary education grouped by country and year which I can then input to create an education index?
The issue is, to create shares, I need a column with totals and I am unable to have the column filled and I have to copy paste the two lines of fill multiple times. How do I create shares of people in secondary and tertiary education grouped by country and year which I can then input to create an education index?
Code:
eurostatuse edat_lfse_03, noflags label long noerase clear save "$Input\\edat_lfse_03.dta", replace ren time year keep if sex == "T" drop sex sex_label keep if age == "Y15-64" *Generate share columns with just share of the population with tertiary education and secondary education (This is where I have a problem) I want separate column with just shares of people in different educ categories bys geo year: gen long tert_educ=edat_lfse_03 if isced11_label=="Tertiary education (levels 5-8)" bys geo year: replace tert_educ= tert_educ[_n-1] if missing(tert_educ) //fill in by country and year bys geo year: replace tert_educ= tert_educ[_n+1] if missing(tert_educ) *calculate education index bys geo year: gen educ_index = 0.33*(1-sec_educ) + 0.67*(tert_educ)
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str1 freq str6 freq_label str1 sex str7 sex_label str6 age str19 age_label str2 unit str10 unit_label str8 isced11 str87 isced11_label str9 geo str41 geo_label int time double edat_lfse_03 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 1992 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 1993 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 1994 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 1995 41.4 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 1996 39.6 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 1997 36.6 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 1998 36 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 1999 35.3 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2000 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2001 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2002 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2003 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2004 28.4 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2005 28.2 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2006 29.6 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2007 30 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2008 28.8 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2009 28 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2010 27 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2011 26.6 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2012 25.9 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2013 25.4 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2014 23.2 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2015 22.5 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2016 22.1 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2017 21.4 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2018 21.1 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2019 20.5 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2020 20.3 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2021 20 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2022 19.9 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "AT" "Austria" 2023 19.9 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 1992 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 1993 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 1994 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 1995 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 1996 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 1997 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 1998 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 1999 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2000 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2001 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2002 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2003 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2004 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2005 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2006 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2007 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2008 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2009 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2010 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2011 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2012 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2013 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2014 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2015 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2016 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2017 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2018 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2019 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2020 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2021 28.8 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2022 28.4 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BA" "Bosnia and Herzegovina" 2023 27.9 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 1992 50.9 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 1993 50.5 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 1994 48.8 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 1995 47.7 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 1996 45.2 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 1997 44 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 1998 44.3 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 1999 43.5 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2000 41.8 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2001 41.4 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2002 40 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2003 39 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2004 37.6 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2005 35.9 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2006 35 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2007 34.4 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2008 33 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2009 31.7 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2010 31.7 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2011 30.7 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2012 30.1 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2013 29 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2014 28.1 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2015 27.3 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2016 27.1 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2017 26 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2018 25.1 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2019 24 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2020 23.2 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2021 21.2 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2022 20.5 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BE" "Belgium" 2023 21.3 "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BG" "Bulgaria" 1992 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BG" "Bulgaria" 1993 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BG" "Bulgaria" 1994 . "A" "Annual" "F" "Females" "Y15-64" "From 15 to 64 years" "PC" "Percentage" "ED0-2" "Less than primary, primary and lower secondary education (levels 0-2)" "BG" "Bulgaria" 1995 . end
Comment