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
Diamond | Level 26
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
Diamond | Level 26
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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 4 replies
  • 1247 views
  • 1 like
  • 3 in conversation