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
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.
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.
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.
Ah, good old TABULATE. One of my favorite PROCs and that definitely will do what I want to do.
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!
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.
Ready to level-up your skills? Choose your own adventure.