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
-catplot-: Suppress automatic title under x-axis?Dear all, I am creating a graph much like this: Code: sysuse auto, clear catplot rep78, over(forei…
Multiple conditions within loopHello, Stata Users! My question might seem too simple, but I am struggling with generating new vari…
Generating a change score variableHi Statalist, I am trying to generate a change score that captures changes in labour force particip…
tsline command with maximum observationsDear Stata community, I am running the tsline command for a graph of average male unemployment by c…
random fixed effect model of panel dataHi, I am trying to anlysis an (unbalanced) panel data which covers around 6000 companies (79000 fri…
Subscribe to:
Post Comments (Atom)
0 Response to Variable creation
Post a Comment