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

Hi All,

 

I am trying to resolve the macro variable in the define statement in proc report in order to generate treatment count and name in the tables with below code but the code is not resolving. Can you please help me out to resolve &trt01count. and &trt01.

 

proc sql;
select trtseqp into:trt01
from bign_counts
where trtseqpn = 1
;

select count into:trt01count
from bign_counts
where trtseqpn = 1
;
quit;
%put &trt01count;
%put &trt01;

proc report data=final_tp nowd spacing=1 LS = 200 headline headskip split='|' panels=1 style(header)=header{just=left}
style(column)=header{just=left cellwidth=0.3in } missing;

title1 bold "Table 1.6 Disc Test";
title2 bold "All Enrolled Subjects" ;

columns popfl _1 _2 _999;

define popfl / order order=internal left ' ' style ={just=left cellwidth=.47in};
define _1 / order order=internal left '&trt01.|N=&trt01count.|n(%)' style ={just=left cellwidth=.28in} ;
define _2 / order order=internal left '&trt02.|N=&trt02count.|n(%)' style ={just=left cellwidth=.28in} ;

*by pageit;
compute before _page_/style = [JUST=center];
line '^R"\brdrb\brdrs"';
line '';
endcomp;
compute after _page_ / style = [JUST=LEFT font_size =9pt font_style=italic];;
line " " ;
line "Created by %sysfunc(getoption(sysin)) on %left(&rundayf):%left(&runtimef)";
line "Reference: Transfer ID: &_transfer_id. on %left(&_extract_date)";
endcomp;
run;

 

 

Thanks,

Kumar.

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19
Use "double" quotes to have SAS resolve macro variables.

define _1 / order order=internal left "'&trt01.|N=&trt01count.|n(%)" style ={just=left cellwidth=.28in} ;0

View solution in original post

2 REPLIES 2
data_null__
Jade | Level 19
Use "double" quotes to have SAS resolve macro variables.

define _1 / order order=internal left "'&trt01.|N=&trt01count.|n(%)" style ={just=left cellwidth=.28in} ;0
WarrenKuhfeld
Ammonite | Level 13

Macro variables resolve inside double quotes and outside of quotes but not inside single quotes. This is by design.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 2 replies
  • 2460 views
  • 2 likes
  • 3 in conversation