Dear all,
I would like to create a ratio of grswage by sex for different percentile of the grswage distribution and different years(wave).
I have created the percentile for each wave and sex by:
the ratio that I want to create looks like for example:
bys wave: gen p5_ratio = p5_grswage (sex==2) /p5_grswage (sex==1)
bys wave: gen p10_ratio = p10_grswage (sex==2) /p10_grswage (sex==1)
.
.
.
But then the code does not work since in a row I miss the counter sex percentile, is it possible that I am required to create the percentile of grswage differently?
Thanks
I would like to create a ratio of grswage by sex for different percentile of the grswage distribution and different years(wave).
I have created the percentile for each wave and sex by:
Code:
summ grswage, detail return list bys wave sex: egen p25_grswage = pctile(grswage), p(5) bys wave sex: egen p50_grswage = pctile(grswage), p(10) . . .
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long pidp float wave byte sex float(grswage p10_grswage p25_grswage p50_grswage p75_grswage p90_grswage) 748802411 19 1 18.06866 7.531728 9.926337 14.07158 20.242 28.08492 1632819407 19 1 40.87979 7.531728 9.926337 14.07158 20.242 28.08492 136456967 19 1 22.75313 7.531728 9.926337 14.07158 20.242 28.08492 136459687 19 1 21.114985 7.531728 9.926337 14.07158 20.242 28.08492 204004771 19 1 14.220705 7.531728 9.926337 14.07158 20.242 28.08492 545825807 19 1 21.53421 7.531728 9.926337 14.07158 20.242 28.08492 136501171 19 1 13.067676 7.531728 9.926337 14.07158 20.242 28.08492 680020411 19 1 9.381696 7.531728 9.926337 14.07158 20.242 28.08492 613290647 19 1 28.01674 7.531728 9.926337 14.07158 20.242 28.08492 204141451 19 1 24.886234 7.531728 9.926337 14.07158 20.242 28.08492 478726811 19 2 25.59727 6.952345 8.887941 12.189176 16.93674 22.69262 816343411 19 2 18.987183 6.952345 8.887941 12.189176 16.93674 22.69262 478728171 19 2 5.688282 6.952345 8.887941 12.189176 16.93674 22.69262 478733623 19 2 6.110933 6.952345 8.887941 12.189176 16.93674 22.69262 612578007 19 2 11.850614 6.952345 8.887941 12.189176 16.93674 22.69262 1564019047 19 2 11.145958 6.952345 8.887941 12.189176 16.93674 22.69262 884348847 19 2 9.751341 6.952345 8.887941 12.189176 16.93674 22.69262 273297447 19 2 16.389091 6.952345 8.887941 12.189176 16.93674 22.69262 612276087 19 2 5.17517 6.952345 8.887941 12.189176 16.93674 22.69262 884407327 19 2 9.090909 6.952345 8.887941 12.189176 16.93674 22.69262 884403931 19 2 22.42006 6.952345 8.887941 12.189176 16.93674 22.69262 end format %ty wave label values sex a_sex label def a_sex 1 "male", modify label def a_sex 2 "female", modify
bys wave: gen p5_ratio = p5_grswage (sex==2) /p5_grswage (sex==1)
bys wave: gen p10_ratio = p10_grswage (sex==2) /p10_grswage (sex==1)
.
.
.
But then the code does not work since in a row I miss the counter sex percentile, is it possible that I am required to create the percentile of grswage differently?
Thanks
Comment