Hi,
How can I get the below proc report output to show the statistics vertically? After every visit, I want to show all the statistics going down.
Here is the code I currently have:
proc report data=Test;
columns visit Groups, adlscore_: ;
define visit / 'Visit' group ;
define adlscore_N / ANALYSIS "N" Spacing=2;
define adlscore_Mean / analysis "Mean" format=6.2 Spacing=2;
define ADLSCORE_StdDev / analysis "SD" format=6.2 Spacing=2;
define ADLSCORE_LCLM / analysis "L95%CI" format=6.2 Spacing=2;
define ADLSCORE_UCLM / analysis "U95%CI" format=6.2 Spacing=2;
define ADLSCORE_Median /analysis "Median" format=6.2 Spacing=2;
define ADLSCORE_Min / analysis "Min" format=6.2 Spacing=2;
define ADLSCORE_Max / analysis "Max" format=6.2;
define groups / across ;
endcomp;
run;
Here is how the output should look
This request seems to go against the grain of PROC REPORT.
You would need to re-arrange your data set and create a variable that takes on values N MEAN MIN MAX etc. So on the rows where this variable has the value N, you have the statistic n; on the rows with MEAN you have the statistic mean; and so on.
Adding: you can in the wide layout that you show, have all the N together (three columns, one each for group 0, 1 and 2) and then have all the means together (three columns, one each for group 0, 1 and 2), and so on. This isn't hard to do in PROC REPORT.
Not sure I follow
PROC TABULATE seems like it would work here if you use the raw data rather than summarized data?
Something like this:
proc tabulate data=test;
class visits groups;
var adlscore;
table visit * adlscore*(N MEAN STD LCLM UCLM MEDIAN MIN MAX), groups;
run;
@Etoo12121 wrote:
Hi,
How can I get the below proc report output to show the statistics vertically? After every visit, I want to show all the statistics going down.
Here is the code I currently have:
proc report data=Test;
columns visit Groups, adlscore_: ;
define visit / 'Visit' group ;
define adlscore_N / ANALYSIS "N" Spacing=2;
define adlscore_Mean / analysis "Mean" format=6.2 Spacing=2;
define ADLSCORE_StdDev / analysis "SD" format=6.2 Spacing=2;
define ADLSCORE_LCLM / analysis "L95%CI" format=6.2 Spacing=2;
define ADLSCORE_UCLM / analysis "U95%CI" format=6.2 Spacing=2;
define ADLSCORE_Median /analysis "Median" format=6.2 Spacing=2;
define ADLSCORE_Min / analysis "Min" format=6.2 Spacing=2;
define ADLSCORE_Max / analysis "Max" format=6.2;
define groups / across ;endcomp;
run;
Here is how the output should look
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.