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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 608 views
  • 0 likes
  • 2 in conversation