To draw wages by percentiles over time, in this link: https://www.theanalysisfactor.com/cr...bserve-trends/
the code is:
gen ptl=0 // variable for percentile
preserve
forvalues x=10(10)90{
collapse (p`x’) wage1985-wage2005 (mean)ptl
replace ptl=`x’
save wage`x’,replace
restore,preserve
}
use wage10,clear
forvalues x=20(10)90{
append using wage`x’
save wage_ptl,replace
}
use wage_ptl,clear
order ptl, first // moving the variable “ptl” to the top of the list
....(after that they use the xtset command etc.)
Now, when I run the second part of it, all the wage values become zero (probably because of the CLEAR command)
Please suggest what's wrong here.
Thanks a lot.
the code is:
gen ptl=0 // variable for percentile
preserve
forvalues x=10(10)90{
collapse (p`x’) wage1985-wage2005 (mean)ptl
replace ptl=`x’
save wage`x’,replace
restore,preserve
}
use wage10,clear
forvalues x=20(10)90{
append using wage`x’
save wage_ptl,replace
}
use wage_ptl,clear
order ptl, first // moving the variable “ptl” to the top of the list
....(after that they use the xtset command etc.)
Now, when I run the second part of it, all the wage values become zero (probably because of the CLEAR command)
Please suggest what's wrong here.
Thanks a lot.
