@Thomas_mp wrote:
It works perfectly , thank you !!!
Not sure why did not work before...
I have one more question that is the next step in the task I am trying to do.
Once I have the 50 ratios : ratio_n1, ratio_n2... ratio_n50, in 50 different columns, I need to get some statistics of all and of different sub-sets of these observations.
For instance the astandard deviation of the first 10 observations.
stdv(ratio_n1, ratio_n2..... ratio_n10)
A second step, which may be more difficult, is to compute the standard deviation only if there are >= 5 non-missing observations.
Thank you again.
It is very poor planning to use a rule like "standard deviation of the first 10 observations". Reason: data sets get sorted all the time and the output of some procedures may reorder the data in some fashion. If the rule does not involve the value of one or more variables such as "idvar is value 3" or "idvar in the range 2 to 5 and timevar < 25" then the programming is going to be obnoxious at best and fragile, hard to maintain, hard to understand and possibly just plain wrong in an unobvious manner at worst. Proc means, summary, tabulate and report can do standard deviations and other statistics.
From your original post: I have 50 columns of the “measure” (roa) in different years: As @RW9 mentioned you might be better to have that actual YEAR value then that could be used as one of the groups. In fact if your groups are all based on that original year it may well be that this whole exercise could likely be cleaned up by maintaining year and grouping by year values.
As far as your requirement to calculate when there are 5 or more nonmissing values when you use Proc Means or summary you 1) request an associated N statistic and 2) filter or set to missing based on the value of that n.
... View more