BookmarkSubscribeRSS Feed
Ivy
Quartz | Level 8 Ivy
Quartz | Level 8

Hello,

 

I am tyring to output the data, with one variable treated as group variable , using following codes, but somehow the group option does not work.  

 

"define var_label/ display "Demographic and Clinical characteristics " spacing=0 group flow order;" 

 

var_label 

Gender, n(%)

Gender, n(%)

 

I would like to show one Gender, n(%) , but somehow, it still showes two.

 

proc REPORT data= _table_1 nowd headline missing nocenter spacing=0 ls=256 ps=1000 split='^' style(header)=[font_weight=bold just=center] style(column)=[just=center];
column vord rord var_label var_level _2007 _2008 _2009 _2010 _2011 _2012 _2013 _2014 Total ;
define vord/noprint order;
define rord/noprint order;
define var_label/ display "Demographic and Clinical characteristics " spacing=0 group flow order;
define var_level/display "" spacing=0 order;

define _2007/display "Index_year_2007 (N=&gp_2007)" width=18;
define _2008/display "Index_year_2008 (N=&gp_2008)" width=18;
define _2009/display "Index_year_2009 (N=&gp_2009)" width=18;
define _2010/display "Index_year_2010 (N=&gp_2010)" width=18;
define _2011/display "Index_year_2011 (N=&gp_2011)" width=18;
define _2012/display "Index_year_2012 (N=&gp_2012)" width=18;
define _2013/display "Index_year_2013 (N=&gp_2013)" width=18;
define _2014/display "Index_year_2014 (N=&gp_2014)" width=18;
define Total/display "Index_year_total (N=&gp_Total)" width=18;

title "Table 1. Baseline demographic and clinic characteristics ";
run;
quit;

 

Thank you,

 

Ivy 

9 REPLIES 9
Reeza
Super User

You have var_label listed twice - two define statements. 

 

Ivy
Quartz | Level 8 Ivy
Quartz | Level 8
Thank you, Reeza.
I double check it, I just list once. Var_label, var_level . Two different names. Did I miss something ? Thank you.
Reeza
Super User

You're correct, I misread it. 

 

I'm not familiar enough with Proc Report to help beyond this, especially without sample input data. I'm sure someone else will help. 

It may help if you post an image of what you're getting and an example of what you want as well. 

Good Luck.

Ivy
Quartz | Level 8 Ivy
Quartz | Level 8

Examples data;

Var_label                                 var_level                     ..........................
Gender, n(%)                          Male
Gender, n(%)                         Female

 

Output table I want:

 

Var_label          Var_level ........................

Gender, n(%)    Male

                         Female 



Thanks.

ballardw
Super User

You define Var_label as both group and order. Try having it as just order.

Can't test without data but those sort of conflict and often the last option mentioned controls when conflicting.

Ivy
Quartz | Level 8 Ivy
Quartz | Level 8
I use group, order separately, but somehow, it still dose not work 😞

demog Index_year_2007 (N=429) Index_year_2008 (N=585)
Age at index N 429 585
Age at index Mean (SD) 62.2 (11.7) 60.8 (11.6)
Age at index Median(Min - Max) 61 (28-89) 60 (29-90)
Gender, n(%) Female 107 (24.9) 151 (25.8)
Gender, n(%) Male 322 (75.1) 434 (74.2)
Geographic region, n(%) South 149 (34.7) 219 (37.4)
Geographic region, n(%) North Central 148 (34.5) 191 (32.6)
Geographic region, n(%) Northeast 43 (10) 55 (9.4)
Geographic region, n(%) West 56 (13.1) 80 (13.7)
Geographic region, n(%) Unknown 33 (7.7) 40 (6.8)
Ksharp
Super User
You'd better post some data to let us test your code and reproduce the problem.
And try compute block:



 compute var_label;
   if var_label ne lag(var_label) then call missing(var_label);
endcomp;

Cynthia_sas
SAS Super FREQ
I do not think the LAG or DIF functions work in PROC REPORT, the OP has other problems with her code (she has DISPLAY, GROUP and ORDER in one DEFINE statement) which is more problematic. She needs to fix her other issues with the code before introducing COMPUTE blocks.

cynthia
Ksharp
Super User
That is reason why I ask OP to post data .
We all just guessing.
We don't know if GROUP could work or COMPUTE could work .


SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 9 replies
  • 3765 views
  • 0 likes
  • 5 in conversation