[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sas-l
Subject:    Re: Creating a Pivot-like table in SAS
From:       "Keintz, H. Mark" <mkeintz () WHARTON ! UPENN ! EDU>
Date:       2011-05-27 17:36:47
Message-ID: E0B423A8C0D1E74B8905B2C5CB38C1AF1AF721 () GENO3 ! wharton ! upenn ! edu
[Download RAW message or body]

Rich:

I think this is a natural for PROC TABULATE, as in:


data have;
  input course :$6.  grade :$1. n_visits n_students @@;
datalines;
FIN501 A 1  23   FIN501 B 1   8   FIN501 A 3  20
FIN501 C 2   8   FIN501 W 1   3
SOC501 A 1  32   SOC501 B 2   8   SOC501 C 1   3
SOC501 A 3  20   SOC501 C 2   8   SOC501 W 1   3
run;

proc tabulate noseps missing;
  class course grade n_visits;
  tables  course                       /*Page dimension*/
        , grade all='All'              /*Row dimension */
        , (n_visits all='All') *f=10.0 /*Col dimension */ ;
  freq n_students;
run;


There will be one table for each course, on a separate page of the output file.


Mark Keintz
Wharton Research Data Services


-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Rich Griffiths
Sent: Wednesday, May 25, 2011 5:46 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Creating a Pivot-like table in SAS

Hi Everyone,


I have been able to create some useful output in SAS by merging student grades with \
learning lab visits. My output table has the following columns:
Course (17 different courses), Grade Category (A,B,C,D,F,W), #Visits (categorized \
into 4 groups), Counts of Students

What I want to do is to produce a table in SAS for each course with the Grade as the \
rows and the # visits (4 groups) as the columns and student counts as the contents of \
the table. I have been able to do this with an excel pivot table but having trouble \
with SAS.

Thanks,

Rich


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic