Dear All,
I am working with firm level data. I want to generate a variable lsales = ln(sales) and want to replace the values in lsales as missing if the values in the variable lsales are higher than mean+3*standard deviation. While doing so, I want the summary stat of lsales by grouping state and sector and if the observation of lsales is more than 1000 in the individual group (state-sector) then find the outlier and replace it as missing. If the number of observation is less than 1000 in any of the group (state-sector) then I want to group lsales by the state only and find out the summary stat and replace the outlier with missing values. Please suggest to me how should I code this, as I am unable to visualise the loop for the condition.
Thanks
Prakash
Related Posts with Generating variable and replacing the outlier as missing based on grouping and condition
Twoway graph of treated/control means by group with smoothingHi all, I am trying to generate some plots using the means for treatment/control group for various g…
Matching data in a case controlHello there, I am trying to match data for a case control study on a positive cancer diagnosis on b…
Multiple conditions within loopHello, Stata Users! My question might seem too simple, but I am struggling with generating new vari…
Specifying Identity Equation for Forecast of ARIMA(0,1,1) With and Without a ConstantI am estimating an arima(0,1,1) and then using the forecast suite but am having difficulty in specif…
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 Generating variable and replacing the outlier as missing based on grouping and condition
Post a Comment