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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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