Hi everyone! I have this dataset for Colombia, with country code, department code, year, a key variable with age groups and number of births per age group, department and year. I need to create a new variable only with missing information (values with Sin information "170005_1998_Sin information") repeated for the same department and year. Ex. the first department is 005 = Antioquia for the year=1998 and missing values for the age group are = 774 (for 774 births there is no information about the mother's age). I need a new variable with 774 repeated across the 9 age groups for Antioquia in 1998, for further investigation and merges.
* Example generated by -dataex-. To install: ssc install dataex
clear
input float raw_country str3 raw_geolev1 double raw_yearbir str28 key float births_count
170 "005" 1998 "170005_1998_10-14" 756
170 "005" 1998 "170005_1998_15-19" 21667
170 "005" 1998 "170005_1998_20-24" 26981
170 "005" 1998 "170005_1998_25-29" 21990
170 "005" 1998 "170005_1998_30-34" 16317
170 "005" 1998 "170005_1998_35-39" 8888
170 "005" 1998 "170005_1998_40-44" 2205
170 "005" 1998 "170005_1998_45-49" 167
170 "005" 1998 "170005_1998_50-54" 20
170 "005" 1998 "170005_1998_Sin informacion" 774
170 "008" 1998 "170008_1998_10-14" 170
170 "008" 1998 "170008_1998_15-19" 6776
170 "008" 1998 "170008_1998_20-24" 11185
170 "008" 1998 "170008_1998_25-29" 10067
170 "008" 1998 "170008_1998_30-34" 6336
170 "008" 1998 "170008_1998_35-39" 2792
170 "008" 1998 "170008_1998_40-44" 490
170 "008" 1998 "170008_1998_45-49" 51
170 "008" 1998 "170008_1998_50-54" 3
170 "008" 1998 "170008_1998_Sin informacion" 510
170 "011" 1998 "170011_1998_10-14" 606
It seems easy, but I can't find the solution. Thank you in advance for your help!!
* Example generated by -dataex-. To install: ssc install dataex
clear
input float raw_country str3 raw_geolev1 double raw_yearbir str28 key float births_count
170 "005" 1998 "170005_1998_10-14" 756
170 "005" 1998 "170005_1998_15-19" 21667
170 "005" 1998 "170005_1998_20-24" 26981
170 "005" 1998 "170005_1998_25-29" 21990
170 "005" 1998 "170005_1998_30-34" 16317
170 "005" 1998 "170005_1998_35-39" 8888
170 "005" 1998 "170005_1998_40-44" 2205
170 "005" 1998 "170005_1998_45-49" 167
170 "005" 1998 "170005_1998_50-54" 20
170 "005" 1998 "170005_1998_Sin informacion" 774
170 "008" 1998 "170008_1998_10-14" 170
170 "008" 1998 "170008_1998_15-19" 6776
170 "008" 1998 "170008_1998_20-24" 11185
170 "008" 1998 "170008_1998_25-29" 10067
170 "008" 1998 "170008_1998_30-34" 6336
170 "008" 1998 "170008_1998_35-39" 2792
170 "008" 1998 "170008_1998_40-44" 490
170 "008" 1998 "170008_1998_45-49" 51
170 "008" 1998 "170008_1998_50-54" 3
170 "008" 1998 "170008_1998_Sin informacion" 510
170 "011" 1998 "170011_1998_10-14" 606
It seems easy, but I can't find the solution. Thank you in advance for your help!!

Comment