Hi Profs and Colleagues,
I am encountering an issue while creating shift-share aggregated variables using ssaggregate-user wrriten by Kirill Borusyak et al- in Stata. My dataset contains residualized outcome variables (y_resid and x_resid) at the skill-experience-time level, exposure weights (sh_sum) representing historical shares of immigrant populations by skill group, and baseline employment/size variables (L_s0). I reshaped the data to wide format using reshape wide y_resid x_resid sh_sum L_s0, i(Expgroup) j(sk_rat_quartile), which successfully generated wide variables: y_resid1–y_resid4, x_resid1–x_resid4, sh_sum1–sh_sum4, and L_s01–L_s04. However, when I run ssaggregate specifying all outcome variables together with their corresponding n() and s() variables, the output only retains the sh_sum* variables, and no _agg variables for the outcomes appear. I am unsure how to generate the aggregated outcomes efficiently without reloading the master dataset for each variable. Could you please advise on the proper procedure for aggregating multiple outcomes in wide format, or whether it would be better to switch to using long exposure weights saved separately?
Cheers,
Paris
I am encountering an issue while creating shift-share aggregated variables using ssaggregate-user wrriten by Kirill Borusyak et al- in Stata. My dataset contains residualized outcome variables (y_resid and x_resid) at the skill-experience-time level, exposure weights (sh_sum) representing historical shares of immigrant populations by skill group, and baseline employment/size variables (L_s0). I reshaped the data to wide format using reshape wide y_resid x_resid sh_sum L_s0, i(Expgroup) j(sk_rat_quartile), which successfully generated wide variables: y_resid1–y_resid4, x_resid1–x_resid4, sh_sum1–sh_sum4, and L_s01–L_s04. However, when I run ssaggregate specifying all outcome variables together with their corresponding n() and s() variables, the output only retains the sh_sum* variables, and no _agg variables for the outcomes appear. I am unsure how to generate the aggregated outcomes efficiently without reloading the master dataset for each variable. Could you please advise on the proper procedure for aggregating multiple outcomes in wide format, or whether it would be better to switch to using long exposure weights saved separately?
Code:
Expgroup sk_rat_quartile y_resid x_resid L_s0 sh_sum 1 1 .00089722 .00017546 9 510.4223 1 2 .00005864 .00031169 73 859.6541 1 3 .00141016 .00020807 16 54.69637 1 4 -.00256119 -.00070758 35 129.9765 2 1 .00042561 .00007675 26 1911.667 2 2 .00025217 -.0000521 104 976.7396 2 3 -.00072523 -.0000614 16 85.11591 2 4 .00085484 .0001405 56 173.7425 3 1 .00055738 -.00012584 17 2348.409 3 2 -.00003895 .00006545 53 1062.542 3 3 .00008885 -.0000361 5 100.8632 3 4 -.0003825 -.00015356 27 69.47884 4 1 .000137 -.00005818 14 2420.995 4 2 .00003106 -4.424e-06 56 816.1863 4 3 -.00011457 -.00002474 9 95.86609 4 4 -.0000304 -.00005593 36 27.25454 5 1 .00005663 .00001277 8 1146.302 5 2 -.00027512 .00002253 64 185.8535 5 3 -.00059284 -.00003369 12 43.42913 5 4 .00091354 .00017991 46 10.31662 6 1 -.00039024 -.00001259 13 885.0025 6 2 -.00013894 .00012276 58 234.2144 6 3 -.00052741 -.00011237 14 19.03686 6 4 .00096743 .00003149 41 4.724331 7 1 .00012374 .00008723 4 176.9723 7 2 -.00008663 .00009355 90 55.00478 7 3 -.00084974 -.00036027 19 25.61462 7 4 -.00005734 -.00001032 50 3.896273 8 1 .00050911 .00003543 13 77.50749 8 2 -.00017248 .00031768 68 7.479278 8 3 -.00153073 -.00016737 18 4.887123 8 4 -.00108435 .00012775 32 1.504403
Cheers,
Paris

Comment