Hi all, quite new to Stata.
I am doing research on Excess CEO Compensation and I want to regress the natural log of CEO's total compensation on the control variables of CEO compensation. However, I want to perform a separate regression for each company for each year, and use each result as variable for that particular observation.
I've tried the following commands, however it doesn't provide me with the desired results:
sort CIK YEAR
gen expected_comp=.
egen id=group(CIK)
forvalues i=1(1)5696 {
I id CIK if id=='i'
reg logTDC1 logSALES logFS if id=='i '
predict p if id=='i'
replace expected_comp=p if id=='i'
drop p
}
Can anyone help me with this?
Related Posts with create variable based on regressed results per observation
Access instance, class, or function "own" identifiers within the .class fileIn class programming, is there a way to access an instance's, class's or member function's own ident…
Decay measure variable using unbalanced panel dataHello everybody, I would really appreciate any help someone can provide with some coding. I am tryi…
Panel Data - treatment*for group data based on within group characteristicsHello, I am interested in assigning a treatment to a firm if it was domestic (foreign=0) in year 20…
Problems with stset on long dataHi, I'm trying to stset survival data in long format. I used reshape to convert from wide to long: …
Deflate wages with deflator from different fileHello, I need to deflate my wages with a consumer price index which I have in a different file. How…
Subscribe to:
Post Comments (Atom)
0 Response to create variable based on regressed results per observation
Post a Comment