I find a code for generating 97th percentile for each year. However, I am not sure why the percentile_97 need to be replaced by r(c_1). Does it mean that the count of analyst is the % within 97th percentile?
Thank you if you can give me any explanation of the code.
*generating 97th percentile for each year*
gen percentile_97=.
su fiscal_year
scalar a= r(min)
scalar b= r(max)
forvalues i= `=scalar(a)'/`=scalar(b)' {
centile max_analy_count if fiscal_year==`i', cent(97)
replace percentile_97=r(c_1) if fiscal_year==`i'
}
sort ticker analys forecasted_year forecasted_month
Related Posts with understand the stata code
Difference-in-differences analysis, pre-trend fixed-effects by groupHi all, I have been advised by my mentor to incorporate pre-trend fixed-effects that are country-sp…
xtline graphical questionDear All, I have the following code Code: use "dta\cf_index.dta", clear keep if year > 1965 en…
low Cronbach's alphaHi, I am currently in the initial stage of my research and don't have much experience in statistica…
Levelsof questionHi, I am trying to understand how levelsof works. - is it possible to use local labels as labels fo…
How to treat missing dataHi, I am using panel data with the variables Stock_id, date2, price, revenue_M, DE, and TA_M where p…
Subscribe to:
Post Comments (Atom)
0 Response to understand the stata code
Post a Comment