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 (August 2002, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 30 Aug 2002 08:50:13 -0400
Reply-To:     Asheber Sewalem <sewalem@CDN.CA>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
Comments:     To: "Nevseta, Floyd G" <Floyd.G.Nevseta@bankofamerica.com>,
              "Dorfman, Paul" <Paul.Dorfman@BCBSFL.COM>
From:         Asheber Sewalem <sewalem@CDN.CA>
Subject:      Re: transpose
Comments: To: SAS-L@LISTSERV.VT.EDU
Content-Type: text/plain; charset="iso-8859-1"

Hi Floyd,Paul,Prasad and all,

Thanks for your reply,

proc freq data=a; tables code * score / nocol norow nopercent; run;

This is fine this sample data set. However, if the data set is huge with many variables, I usually get an error message. That is why I was trying to avoid using proc freq.

In addition to that I need the actual output file. Therefore, Paul's suggestion is taken as it does it in one data step.

Many thanks Asheber

This is the easiest way:

proc freq data=a; tables code * score / nocol norow nopercent; run;

Regards, Floyd

-----Original Message----- From: Asheber Sewalem [mailto:sewalem@CDN.CA] Sent: Thursday, August 29, 2002 3:33 PM To: SAS-L@LISTSERV.UGA.EDU Subject: transpose

Hi all,

I would appreciate if you give me an efficient way of doing the following data set.(i.e., the total number of observation in each code and by score). I used proc transpose and it did not give me the desired output, may be I missed something. Please have a look at below the desired output.

data a; input id code score; cards ; 161 12 3 139 12 2 120 12 1 163 12 2 144 10 3 143 10 3 135 10 2 132 11 2 147 11 2 143 13 3 170 13 1 155 14 1 ;

The desired output should be,

Obs code score_1 score_2 score_3 total 1 10 0 1 2 3 2 11 0 2 0 2 3 12 1 2 1 4 4 13 1 0 1 2 5 14 1 0 0 1

Asheber


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