BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
VinnyR
Calcite | Level 5
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.Capture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

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 

View solution in original post

2 REPLIES 2
novinosrin
Tourmaline | Level 20

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 

VinnyR
Calcite | Level 5

Thanks, that was quickfix.

Really appreciate your help

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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
  • 2 replies
  • 1302 views
  • 0 likes
  • 2 in conversation