LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sat, 10 Jan 2009 16:41:26 -0500
Reply-To:   "Howard Schreier <hs AT dc-sug DOT org>" <schreier.junk.mail@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Howard Schreier <hs AT dc-sug DOT org>" <schreier.junk.mail@GMAIL.COM>
Subject:   Re: summary question

On Fri, 9 Jan 2009 11:24:05 -0500, Hari Nath <hari_s_nath@YAHOO.COM> wrote:

>Hello all, > > Can somebody help me with proc tabulate. > I have a dataset with variables b1,d1, b2,d2, b3,d3 > I will have to provide a summary on each of the variables. > > data x; > b1=1;b2=1;b3=1;d1=2;d2=1;d3=8;output; > b1=1;b2=3;b3=5;d1=2;d2=1;d3=8;output; > run; > > proc tabulate data=x ; > var b1 b2 b3 d1 d2 d3; > tables b1 b2 b3 d1 d2 d3, sum; > run; > > Even though the code above produces the correct output, I need to have >the output in the format mentioned below. > > B D > ID sum sum > 1 2 4 > 2 4 2 > 3 6 16 > > Thanks for your suggestions in advance

I might not take normalization to the degree that Toby did. After, all the B's and D's might differ in nature and thus have different metadata. Here's a compromise:

proc sql; create view fortabul as select 1 as ID, b1 as B, d1 as D from x union all select 2 , b2 , d2 from x union all select 3 , b3 , d3 from x ; quit;

proc tabulate data=fortabul formchar=' ' noseps; class id; var b d; table id , (b d) * sum * f=4. / rts=6; run;

Result:

B D

Sum Sum

ID 1 2 4 2 4 2 3 6 16


Back to: Top of message | Previous page | Main SAS-L page