Hello everyone,
In a paper I am writing for my studies, I want to recreate a proxy measuring earnings management, developed by Leuz et al. (2003).
I am relatively new to STATA, and I have a question regarding the creation of four variables.
I analyse companies from 28 countries from 2016-2019.
Herefore, I need to create the following variables:
EM 1, defined as the county's median ratio of the firm-level standard deviations of OPPL and OCF.
EM 2, defined as the county-year's spearman correlation between the Delta_ACCR and Delta_OCF.
EM 3, defined as the country-year's median ratio of the absolute value of DACR and the absolute value of CFO
EM 4, defined as the number of SL divided by the number of SP for each country-year.
I have researched and tried some options now, but I am having a hard time with realizing the country-year levels. E.g., for the first variable I tried the following, having stopped at some point (please excuse me if the approach seems unlogical, but I am really new to STATA coding!)
sum OPPL,d
gen standOPPL = r(sd)
sum standOPPL
sum CFO,d
gen standCFO = r(sd)
sum standCFO
gen REM1 = standOPPL/standCFO
sum REM1,d
gen EM1 = r(median)
I am not sure if it's common to ask for such general coding advice, but I would really appreciate it if someone could help me out here as I don't have someone I can ask in my personal environment.
Best regards from Germany, and thank you in advance
Elena
Related Posts with Variable creation
Interpretation of a Regression OutputDear experts, I would like to kindly ask for your help in the interpretation of a regression output…
Creating filename as columns in multiple files dta files before appendingHi, I am trying to include the name of the file as a variable before appending. Please see code bel…
Count unique appearance of values across multiple variables in wide formatHello! It has been a while since I have used Stata and I need a bit of help. I have a wide dataset…
converting "None"(python) to "" (Stata).Hi , manipulating a list in python I ended up with the following tuple, which I need to send to sta…
Exporting psmatch2 results on the matched sample: a solution with esttabI am writing my thesis right now and have had many troubles trying to export the results of the user…
Subscribe to:
Post Comments (Atom)
0 Response to Variable creation
Post a Comment