Date: Tue, 16 Mar 2010 13:51:29 -0400
Reply-To: Judy <statpan@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Judy <statpan@GMAIL.COM>
Subject: Re: Is there an easy way to control the decimal precision
dynamically?
In-Reply-To: <ce1fb7451003160922g2cd8c53cm9441f2f6c3da4502@mail.gmail.com>
Content-Type: text/plain; charset=windows-1252
I have a dataset as shown below and would like to get summary statistics.
I used proc tabulate to get the summary table directly.
However, each variable (V1, V2, V3) could have different decimal precision.
I would like to display the mean and std as one more decimal place
than "data precision". Min and Max the same as "data precision". Data
precision is the maximum decimal for that variable data (in this case,
V1 is 0.01, V2 is 0.1 and V3 is 0.1).
Is there any easy way of doing that? Or proc report?
Thanks,
Judy
/*Code I used */
ods rtf;
proc tabulate data=test;
class VAR Group;
var Value;
table VAR=""*Group="", Value=""*
(mean="Mean"*f=best8.
std="SD"*f =best8.
Min="Min"
Max="Max"
N="N"
)/rts=10 row=float;
run;
ods rtf close;
/*This is the output table I got using the code above*/
Mean SD Min Max N
V1 A 91.994 11.91237 79.51 120.00 10
B 86.737 8.556839 71.63 94.18 10
V2 A 31.61 3.29594 27.60 36.30 10
B 27.73 6.365017 11.00 31.50 10
V3 A 35.07 0.864163 33.40 36.20 10
B 34.24 1.343462 32.70 36.50 10
*********************************************
/*This is the data */
Group VAR Value
A V1 120
A V1 100
A V1 79.51
A V1 79.52
A V1 93.42
A V1 93.52
A V1 84.7
A V1 84.3
A V1 92.57
A V1 92.4
B V1 71.77
B V1 71.63
B V1 85.3
B V1 85.22
B V1 93.4
B V1 92.79
B V1 94.18
B V1 93.68
B V1 89.4
B V1 90
A V2 36.3
A V2 35.7
A V2 27.6
A V2 27.6
A V2 32.9
A V2 33.6
A V2 28.3
A V2 28.8
A V2 32.3
A V2 33
B V2 24.9
B V2 25.3
B V2 31.1
B V2 30.7
B V2 31.5
B V2 31.1
B V2 30.8
B V2 31.1
B V2 29.8
B V2 11
A V3 36.2
A V3 35.7
A V3 34.8
A V3 34.7
A V3 35.2
A V3 35.9
A V3 33.4
A V3 34.1
A V3 35
A V3 35.7
B V3 34.8
B V3 35.3
B V3 36.5
B V3 36.1
B V3 33.8
B V3 33.6
B V3 32.7
B V3 33.2
B V3 33.3
B V3 33.1
**************************************************************
On Tue, Mar 16, 2010 at 12:22 PM, Data _null_; <iebupdte@gmail.com> wrote:
> I think the answer depends on the "display tool".
> PROC TABULATE/REPORT/MEANS/PRINT/ something else.
> and how the data are displayed, stats in rows vs stats in columns that
> sort of thing.
>
> In certain situations Formats are inherited by summary statistics.
>
> Supply more specific information.
>
> On 3/16/10, Judy <statpan@gmail.com> wrote:
>> I want to display the mean/min/max of the data for ten variables. Each
>> variable has different precision in the original data. Is there an
>> easy way in SAS to define the decimal point of the summary statistics
>> according to the data, like what “precision.digit” does in Splus?
>> Thanks,
>>
>