I'm here again to ask you for help.
My starting code is this:
Code:
gen pROE2019=5*(ROE2019Norm<.) gen pROE2018=4*(ROE2018Norm<.) gen pROE2017=3*(ROE2017Norm<.) gen pROE2016=2*(ROE2016Norm<.) gen pROE2015=1*(ROE2015Norm<.) gen pROI2019=5*(ROI2019Norm<.) gen pROI2018=4*(ROI2018Norm<.) gen pROI2017=3*(ROI2017Norm<.) gen pROI2016=2*(ROI2016Norm<.) gen pROI2015=1*(ROI2015Norm<.) gen pLEVERAGE2019=5*(LEVERAGE2019Norm<.) gen pLEVERAGE2018=4*(LEVERAGE2018Norm<.) gen pLEVERAGE2017=3*(LEVERAGE2017Norm<.) gen pLEVERAGE2016=2*(LEVERAGE2016Norm<.) gen pLEVERAGE2015=1*(LEVERAGE2015Norm<.)
Code:
local YearN=2019 forvalues y=`=`YearN'-4'(1)`YearN' { forvalues i=1(1)5 { gen pROE`y'=`i'*(ROE`y'Norm<.) gen pROI`y'=`i'*(ROI`y'Norm<.) gen pLEVERAGE`y'=`i'*(LEVERAGE`y'Norm<.) } }
Thanks again for the help and support you provide!
0 Response to Creating loops with conditions
Post a Comment