BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
doctortimi
Obsidian | Level 7

Capture.JPG

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.

1 ACCEPTED SOLUTION

Accepted Solutions
doctortimi
Obsidian | Level 7

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!

 

View solution in original post

8 REPLIES 8
Tom
Super User Tom
Super User

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.

doctortimi
Obsidian | Level 7

Noted. Thank you.

Reeza
Super User
Ok, so what are you getting and what does the log show? Which part isn't working, and what does your input look like? Can you replicate the whole process by using SAShelp.heart?
doctortimi
Obsidian | Level 7

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; 
doctortimi
Obsidian | Level 7

Hi Reeza,

 

I figured it out. There was an error in my code.

 

Thank you!

Reeza
Super User
Glad you figured it out. I would suggest posting your revised code for other and marking that as the answer so this thread can be closed 🙂
doctortimi
Obsidian | Level 7

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!

 

Tom
Super User Tom
Super User
If you COLUMN statement as VAR1 VAR2 ... and you define VAR2 as GROUP, then VAR1 must be GROUP also.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 8 replies
  • 3224 views
  • 4 likes
  • 3 in conversation