0
votes

I am trying to calculate median, minimum and maximum for several variables for last 5 years in Base SAS. Some of the variables had no cases of diseases in some years, so 0 cases. When I calculate summary in SAS, I want to include these zeros.

For example: one of my variable, lets say X, had 8, 6, 2, 0, 0 cases in the last 5 years respectively. When I calculate the summary of this variable either using "proc-sql" or "proc-means", SAS is ignoring those 0's and giving me something different than what I am expecting. I would like to get Min=0, Max=8 and Median=2, but SAS is giving me Min=2, Max=8 and Median=6 as it is ignoring the zeros.

Any suggestion or direction would be appreciated?

2
if min is 0 then you will have zero. you mean say that your did not have any values for that year/month. can you please provide a sample dataset and sample outputKiran

2 Answers

2
votes

If you truly have missing data you can replace those with zeroes using PROC STDIZE (assuming you have SAS/STAT).

proc stdize data=have out=want replace; run;
0
votes

SAS will include 0, it will not include missing. You possibly have a format on top of your variable that is showing it as 0 when it's actually missing. Try removing the format and see if that's the case, otherwise, this is the default behaviour of SAS.

You can remove formats using:

format var; *note lack of format, which removes the format;

Or if you set option missing to 0 then it shows missing as 0, but the underlying value is still missing and will not be included. You need to actually change the values to 0.