BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
TimH
Quartz | Level 8

I am sure this was probably asked before but I don't know which keywords to bring up what I want - I searched and got a lot of PROC REPORT ACROSS variable stuff but nothing fits just yet, so I'm entering a new message.  Here's what I want to do:   I have datasets that have observations over time,  with an identifier, date, and various measurement variables.  I want to report,  paged or otherwise grouped by identifier, with each date a column, and each variable a row with the variable label on the left and the values under the date columns.

What is the best way to go: 

 

1. Summarize (if necessary) the observations by date, then do PROC TRANSPOSE and PROC PRINT

2. PROC REPORT ?

I am trying to figure out the latte but any and all advice is appreciated

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

See this example using some example data that you should have available:

 

proc tabulate data=sashelp.class;
   class sex; /*your identifier role*/
   class age; /* your "across"*/
   var height weight; /*variables for statistics*/
   table sex,
         (height weight) * (mean max min std),
         age
   ;
run;

The table statement can have 3 "dimensions" separated by commas. If all three are used the first is "page", the seconds is what goes in the row and the third is column.

 

View solution in original post

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

1).  Summarise your data, then do a proc transpose (note I don't use all uppercase!) then you have the option of doing either a proc print or a proc report on the data you have.  Personally I really don't like doing data manipulation in proc report which is a reporting procedure.

ballardw
Super User

See this example using some example data that you should have available:

 

proc tabulate data=sashelp.class;
   class sex; /*your identifier role*/
   class age; /* your "across"*/
   var height weight; /*variables for statistics*/
   table sex,
         (height weight) * (mean max min std),
         age
   ;
run;

The table statement can have 3 "dimensions" separated by commas. If all three are used the first is "page", the seconds is what goes in the row and the third is column.

 

TimH
Quartz | Level 8

Ah, good old TABULATE.   One of my favorite PROCs and that definitely will do what I want to do.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1099 views
  • 0 likes
  • 3 in conversation