Hi , Iam trying to generate median for the variable name = ROA for each industry (SIC Code) and year and my sample from 2009 to 2013
but its seem some missing in this code Code:
but its seem some missing in this code Code:
Code:
gen n1=. gen n2=. foreach v of var roa { forval y=2009/2014 { forval i= 1/89 { count if industry==`i' & year==`y' gen ggg if industry== `i' & year==`y'= r(mean) gen hhh if industry== `i' & year==`y'= r(median) replace n1= ggg if industry== `i' & year==`y' replace n2= hhh if industry== `i' & year==`y' drop ggg drop hhh } } }
Comment