BookmarkSubscribeRSS Feed
elsfy
Quartz | Level 8

Hi,

 

I would like to know if there is a more efficient way of doing this : 

 

proc report data = a ; 

columns var1 var2 var3 var4 ....; 
define var1 / display ; 
define var2 / display ; 
define var3 /display ; 
... ; rbreak after / summarize ; ... ; compute after ; call define ('var1','style','style={bordertopcolor=lightgrey borderbottomcolor=lightgrey}') ; call define ('var2','style','style={bordertopcolor=lightgrey borderbottomcolor=lightgrey}') ; call define ('var2','style','style={bordertopcolor=lightgrey borderbottomcolor=lightgrey}') ;
run ; 

Instead of writing 3x "call define ...." for each variable, i would like to know if i can do it only one time but for the 3 variables/columns. (Just these 3, i have many other columns) 

 

Thanks

 

4 REPLIES 4
PaigeMiller
Diamond | Level 26

A small macro could work here.

--
Paige Miller
Cynthia_sas
SAS Super FREQ
Hi:
If you are changing the entire ROW to be the same, then you can use _ROW_ (without quotes) as the first argument to CALL DEFINE. But the COMPUTE AFTER is changing the summary line. Will style(summary) do what you want in the PROC REPORT statement?
Cynthia
elsfy
Quartz | Level 8
Hi,

I don’t want to change the entire row. I have 10 columns and i just want this instruction for the first 3 columns.

Thank you
Cynthia_sas
SAS Super FREQ
Hi:
What you show is the only way to do it with 3 CALL DEFINE statements. Using macro code or a DO loop would also work, but would make the code more complex.
Cynthia

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!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 611 views
  • 1 like
  • 3 in conversation