options mlogic mprint symbolgen;
%macro visit(indata=, visit=);
data datafile;
set &indata.(where=(visit_="&visit."));
diffm1m2=day1-day2;
meanm1m2=mean(day1,day2);
run;
proc means data=datafile mean std noprint;
by visit_;
var diffm1m2;
output out=mdiff mean=mdiffm1m2 std=sddiffm1m2;
run;
data datafile2_1 datafile2_2 datafile2_3;
if _n_=1 then set mdiff;
set datafile;
drop _freq_ _type_;
newcol=mdiffm1m2;output datafile2_1;
lldiffm1m22=mdiffm1m2-(1.96*sddiffm1m2); newcol=lldiffm1m22;output datafile2_2;
uldiffm1m22=mdiffm1m2+(1.96*sddiffm1m2);newcol=uldiffm1m22;output datafile2_3;
run;
data datafile2;
set datafile2_1 datafile2_2 datafile2_3;
run;
options nonumber nodate;
title1 j=c %if visit_ ne "" %then %do; 'Bland-Altman Plot for Day 1 and Day 2 observed values at &visit.'; %end;
%else %do; "Bland-Altman Plot for Day 1 and Day 2 observed values"; %end;
title2 j=c "Efficacy Set";
footnote1 " ";
ods graphics / reset width=1200px height=700px imagename='Full' ;
ods listing close;
ods escapechar='~';
ODS rtf FILE = "&outpath.&output..rtf";
symbol value=dot interpol=join repeat=100;
proc sgplot data=datafile2;
scatter x=meanm1m2 y=diffm1m2/ markerattrs=(color=green);
refline lldiffm1m22 / axis=y lineattrs=(color=red pattern=4 thickness=2pt);
refline mdiffm1m2/ axis=y lineattrs=(color=blue thickness=2pt);
refline uldiffm1m22/ axis=y lineattrs=(color=red pattern=4 thickness=2pt);
yaxis label='Day 1 - Day 2' labelattrs=(style=normal );
xaxis label='Mean of Day 1 and Day 2';
run;
ods rtf close;
ods listing;
%mend;
%visit(indata=all1, visit=Baseline);
Hi , why is my code not resolving for macro variable in the title statement? attached is the code as well as excerpt of the sas log.
enclose this in double quotes
"Bland-Altman Plot for Day 1 and Day 2 observed values at &visit.";
In your existing code, the macro variable visit do not resolve in a literal that's enclosed with single quotes
enclose this in double quotes
"Bland-Altman Plot for Day 1 and Day 2 observed values at &visit.";
In your existing code, the macro variable visit do not resolve in a literal that's enclosed with single quotes
Thanks, that was quickfix.
Really appreciate your help
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!
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.