- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am running some basic descriptive statistics using PROC MEANS (Means, Medians, IQR, etc.). However, the median and IQR values are being automatically rounded to the integer value. Is there a way that I can have it report to a particular decimal place (such as the tenth, in 0.25 increments; rather than '4' could be '3.75' for example)?
Thank you. (using SAS version 9.4 windowing environment)
PROC MEANS DATA = clean2 N MEAN STDDEV MEDIAN P25 P75 MIN MAX maxdec=2;
class age;
var hosp_dur_1 ;
format age agecat.;
RUN;
Output:
4820 | 4.90 | 7.94 | 3.00 | 3.00 | 5.00 | 1.00 | 328.00 |
4080 | 4.58 | 5.13 | 3.00 | 3.00 | 5.00 | 1.00 | 122.00 |
11996 | 7.71 | 320.16 | 4.00 | 3.00 | 5.00 | -1.00 | 35066.00 |
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
In the proc means you cannot specify a round-off unit.
You would have to output the stats to a table then use the round function in
the Data Step.
In you proc means add:
OUTPUT OUT=MYTABLE MEDIAN=MEDIAN P25=P25 P75=P75;
Data Step would look something like this:
data new;
set MYTABLE;
median=round(median,.25);
p25=round(p25,.25);
P75=round(P75,.25);
format median p25 P75 10.4;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What makes you think rounding is occurring and the 0's are not valid?
If you have a value that's measured in integers I would expect to see either 0, or 0.5 as the decimal portions unless you have a lot of ties.
FYI - you're reporting percentiles (components of IQR) but not IQR as far as I can see in that code.
@lsandell wrote:
I am running some basic descriptive statistics using PROC MEANS (Means, Medians, IQR, etc.). However, the median and IQR values are being automatically rounded to the integer value. Is there a way that I can have it report to a particular decimal place (such as the tenth, in 0.25 increments; rather than '4' could be '3.75' for example)?
Thank you. (using SAS version 9.4 windowing environment)
PROC MEANS DATA = clean2 N MEAN STDDEV MEDIAN P25 P75 MIN MAX maxdec=2; class age; var hosp_dur_1 ; format age agecat.; RUN;
Output:
N Mean Std Dev Median 25th Pctl 75th Pctl Minimum Maximum
4820 4.90 7.94 3.00 3.00 5.00 1.00 328.00 4080 4.58 5.13 3.00 3.00 5.00 1.00 122.00 11996 7.71 320.16 4.00 3.00 5.00 -1.00 35066.00
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
In the proc means you cannot specify a round-off unit.
You would have to output the stats to a table then use the round function in
the Data Step.
In you proc means add:
OUTPUT OUT=MYTABLE MEDIAN=MEDIAN P25=P25 P75=P75;
Data Step would look something like this:
data new;
set MYTABLE;
median=round(median,.25);
p25=round(p25,.25);
P75=round(P75,.25);
format median p25 P75 10.4;
run;