Date: Thu, 5 Aug 2010 15:15:25 -0400
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: Proc SUMMARY output dataset
Richard,
If you want the same format for all of the sum fields you can also do it
by changing the template and using the noinherit option. E.g.:
data test;
input x y z;
format x y z 2.;
cards;
1 1 1
2 2 2
3 3 3
;
run;
ods path work.myTmp(update) sasuser.templat(read) sashelp.tmplmst(read);
proc template;
define table Base.Summary;
column (sum);
define sum;
header = "Variable";
format = 12.;
end;
end;
run;
proc summary data=test;
var x y z;
OUTPUT out=want SUM (X Y Z) = X_SUM
Y_SUM
Z_SUM
/ noinherit;
run;
Art
----------
On Thu, 5 Aug 2010 14:07:48 -0500, Data _null_; <iebupdte@GMAIL.COM> wrote:
>NOINHERIT does work but If you want the statistics to have specific
>formats you can it. But to suppres a warning you need to involve the
>:.
>
>proc summary data=sashelp.shoes;
> output out=test
> sum(Stores Sales Inventory Returns)
> = Stores_sum Sales_sum Inventory_sum Returns_sum;
> format Stores_sum: F10. Sales_sum: Best12. Inventory_sum:
>Returns_sum: comma20.;
> run;
>proc contents order=varnum;
> run;
>proc print;
> run;
>
># Variable Type Len Format Informat Label
>
>1 _TYPE_ Num 8
>2 _FREQ_ Num 8
>3 Stores_sum Num 8 F10. Number of
Stores
>4 Sales_sum Num 8 BEST12. DOLLAR12. Total Sales
>5 Inventory_sum Num 8 COMMA20. DOLLAR12. Total
Inventory
>6 Returns_sum Num 8 COMMA20. DOLLAR12. Total
Returns
>
>
>
>On 8/5/10, Richard DeVenezia <rdevenezia@gmail.com> wrote:
>> In a Proc SUMMARY OUTPUT statement is there a way to set the format of
>> the created variables ?
>>
>> Conside a table with x,y,z formatted 2.
>>
>> The statement
>> OUTPUT SUM ( X Y Z ) = X_SUM Y_SUM Z_SUM
>>
>> causes X_SUM Y_ZUM and Z_SUM to inherit the 2. format and I need
>> something like 8. or 12. instead
>>
>> -
>> Richard A. DeVenezia
>>