Dear all,
I am currently conducting research on the performance of IPOs vs. 'normal' firms. To do so, I have to classify the normal firms into 9 categories, based on their total assets (category 1-3) & their margins (category 1-3). The problem that I am now running into is that these categories have to be constructed per year & per industry. (For example: I need a category 1 for 2008 industry A; as well as a category 1 for 2008 for industry B; etc..)
My final goal would then be to create a new variable, say assetcat, which gives each firm a number from 1-3 based on what category they belong to, ​given their proper year & industry. Once I have this new variable, I can create the same variable for the margin and then I can use the group function to combine them into one variable.
I have tried to cut the firms into categories based on assets using egen cut, however this does not take into account year nor industry.
Now I was trying to construct a simple loop that basically assigns a code from 1-3 based on:
gen assetcat = . levels stockcodenonipo, local(stockcodes)
foreach k of local stockcodes {
forvalues x=2008/2011{
centile totalassetsnonipo, centile(33 66)
replace assetcat=1 if totalassetsnonipo<=r(c_1) & stockcodenonipo==`k' & accountperiodsimplifiednoni==`x'
replace assetcat=2 if totalassetsnonipo>r(c_1) & totalassetsnonipo<=r(c_2)& stockcodenonipo==`k' & accountperiodsimplifiednoni==`x'
replace assetcat=3 if totalassetsnonipo>r(c_2) stockcodenonipo==`k' & accountperiodsimplifiednoni==`x'
}
}
My 2 problems with this loop are:
1) there is a mistake somewhere because my assetcat still ends up with all '.' instead of replacing the values with 1,2 or 3
2) this still does not calculate centiles for each year and industry
Basically, the fact that these 9 categories have to be re-generated for each year & every industry are really confusing me, and I was wondering whether anyone knew of an efficient solution?
Thank you so much in advance for any help!
Best regards,
Janthe
I am currently conducting research on the performance of IPOs vs. 'normal' firms. To do so, I have to classify the normal firms into 9 categories, based on their total assets (category 1-3) & their margins (category 1-3). The problem that I am now running into is that these categories have to be constructed per year & per industry. (For example: I need a category 1 for 2008 industry A; as well as a category 1 for 2008 for industry B; etc..)
My final goal would then be to create a new variable, say assetcat, which gives each firm a number from 1-3 based on what category they belong to, ​given their proper year & industry. Once I have this new variable, I can create the same variable for the margin and then I can use the group function to combine them into one variable.
I have tried to cut the firms into categories based on assets using egen cut, however this does not take into account year nor industry.
Now I was trying to construct a simple loop that basically assigns a code from 1-3 based on:
gen assetcat = . levels stockcodenonipo, local(stockcodes)
foreach k of local stockcodes {
forvalues x=2008/2011{
centile totalassetsnonipo, centile(33 66)
replace assetcat=1 if totalassetsnonipo<=r(c_1) & stockcodenonipo==`k' & accountperiodsimplifiednoni==`x'
replace assetcat=2 if totalassetsnonipo>r(c_1) & totalassetsnonipo<=r(c_2)& stockcodenonipo==`k' & accountperiodsimplifiednoni==`x'
replace assetcat=3 if totalassetsnonipo>r(c_2) stockcodenonipo==`k' & accountperiodsimplifiednoni==`x'
}
}
My 2 problems with this loop are:
1) there is a mistake somewhere because my assetcat still ends up with all '.' instead of replacing the values with 1,2 or 3
2) this still does not calculate centiles for each year and industry
Basically, the fact that these 9 categories have to be re-generated for each year & every industry are really confusing me, and I was wondering whether anyone knew of an efficient solution?
Thank you so much in advance for any help!
Best regards,
Janthe
Comment