Build reports by using ODS to create HTML, PDF, RTF, Excel, text reports and more!

PROC Report with groups across, statistics down?

Accepted Solution Solved
Reply
Contributor
Posts: 32
Accepted Solution

PROC Report with groups across, statistics down?

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


Accepted Solutions
Solution
‎02-02-2018 05:44 PM
Super User
Posts: 13,948

Re: PROC Report with groups across, statistics down?

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


All Replies
Super User
Super User
Posts: 9,866

Re: PROC Report with groups across, statistics down?

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.

Solution
‎02-02-2018 05:44 PM
Super User
Posts: 13,948

Re: PROC Report with groups across, statistics down?

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.

 

Contributor
Posts: 32

Re: PROC Report with groups across, statistics down?

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

☑ This topic is solved.

Need further help from the community? Please ask a new question.

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