Hello SAS Community,
I just started working with proc report this week and I'm having a hard time creating a report. My study is a descriptive comparison of various factors between 2 groups. I already have a dataset with all my descriptive stats created. However, when I run my proc report code, I get this message "NOTE: Groups are not created because the usage of levels is DISPLAY. To avoid this note, change all
GROUP variables to ORDER variables." and my report is partially displayed.
This is my code:
proc report data = report_data nowd
column groupnr indexvar variable levels (Casepct Controlpct pvalue);
define groupnr /order noprint;
define indexvar / order noprint;
define variable /"Characteristics" group;
define levels / " " ;
define Casepct / "Group A" ;
define Controlpct / "Group B";
define pvalue / "P-value" group format = pvalue6.4;
compute before groupnr;
line ' ';
endcomp;
run;
This is what I want my report to look like (screenshot attached above).
Any help will be greatly appreciated.
Attached is the updated code. I had used a different variable in my input dataset to define the 2 groups and p-values.
proc report data = report_data nowd;
column groupnr indexvar variable levels (Case__n_percent Control__n_percent
prob);
define groupnr /order noprint;
define indexvar / order noprint;
define variable /"Characteristics" group;
define levels / " " style(column) = {cellwidth = 1.25in};
define Case__n_percent / "Dead";
define Control__n_percent/ "Alive";
define prob/ "P-value" group format = pvalue6.4;
compute before groupnr;
line ' ';
endcomp;
run;
Thank you, Reeza!
If you want to post a photo don't do it as an attachment. Instead click on the Photos icon in the menu bar and it will let you paste or upload your photo.
Noted. Thank you.
Hi Reeza,
Thank you for replying. My report is actually displaying only the results of my continuous variables. I tried the same code with the sashelp.heart dataset and it's the same output I get in proc report.
I'm attaching my sashelp input dataset and proc report code. For this test data, I am comparing a few variables between Dead/Alive groups.
proc report data = report_data nowd;
column groupnr indexvar variable levels (Case__n_pct Control__n_pct
pvalue);
define groupnr /order noprint;
define indexvar / order noprint;
define variable /"Characteristics" group;
define levels / " " style(column) = {cellwidth = 1.25in};
define Case__n_pct / "Dead";
define Control__n_pct / "Alive";
define pvalue / "P-value" group format = pvalue6.4;
compute before groupnr;
line ' ';
endcomp;
run;
Hi Reeza,
I figured it out. There was an error in my code.
Thank you!
Attached is the updated code. I had used a different variable in my input dataset to define the 2 groups and p-values.
proc report data = report_data nowd;
column groupnr indexvar variable levels (Case__n_percent Control__n_percent
prob);
define groupnr /order noprint;
define indexvar / order noprint;
define variable /"Characteristics" group;
define levels / " " style(column) = {cellwidth = 1.25in};
define Case__n_percent / "Dead";
define Control__n_percent/ "Alive";
define prob/ "P-value" group format = pvalue6.4;
compute before groupnr;
line ' ';
endcomp;
run;
Thank you, Reeza!
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!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.