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.
Macro variables resolve inside double quotes and outside of quotes but not inside single quotes. This is by design.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.