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

in sgplot, how to add macro variable in footnote?

I add macro variables in title and footnote, the title shows but footnote doesn't. I don't know why. anyone can help?

thanks a lot. below is my code.

test.jpg

proc sort data=sashelp.class out=class;
by sex;
run;

data c1;
  set class;
   if sex='M' then do; lloq=5.1; unit='mg/kg';sexn=1; end;
   if sex='F' then do; lloq=3; unit='mg/kg'; sexn=2; end;


run;



%MACRO ODS;
ods rtf file="c:\mean_plot.rtf"     STYLE=Styles.Stat     ;
%MEND;
%ODS;

%MACRO c1(ALLTEST,LL);

      TITLE H=1 font= 'Courier New' c=black "mean figure  of &ALLTEST";
 footnote H=1 j=l font= 'Courier New' c=black 'Notes: dotted line = LLOQ &LL';

      proc sgplot data=c1;
	      
             where 11<=age<=15;
            vline age/response=WEIGHT group=sexn grouporder=ascending stat=mean limitstat=stderr name="a"  markers;
			refline &LL/axis=y label="LLOQ=&ll" LABELLOC= INSIDE lineattrs= (pattern=2);
            xaxis type= linear GRID values=( 0 to 21 by 3);
            yaxis type=log  GRID values=( 1 10 50 100 200) display=all    logstyle=logexpand minor ;
            keylegend 'a'/noborder;
		
      run;

%MEND;
%c1(ALLTEST=test project,LL=20);
ods rtf CLOSE;

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Double quotes. Macro variables on resolve in double quotes,  not single quotes. 

 

Use single quotes if you have text that has an & or % sign in it . Otherwise, in double quotes, SAS will try to interpret that as a macro or macro variable. 

 


@magicdj wrote:

in sgplot, how to add macro variable in footnote?

I add macro variables in title and footnote, the title shows but footnote doesn't. I don't know why. anyone can help?

thanks a lot. below is my code.

test.jpg

proc sort data=sashelp.class out=class;
by sex;
run;

data c1;
  set class;
   if sex='M' then do; lloq=5.1; unit='mg/kg';sexn=1; end;
   if sex='F' then do; lloq=3; unit='mg/kg'; sexn=2; end;


run;



%MACRO ODS;
ods rtf file="c:\mean_plot.rtf"     STYLE=Styles.Stat     ;
%MEND;
%ODS;

%MACRO c1(ALLTEST,LL);

      TITLE H=1 font= 'Courier New' c=black "mean figure  of &ALLTEST";
 footnote H=1 j=l font= 'Courier New' c=black 'Notes: dotted line = LLOQ &LL';

      proc sgplot data=c1;
	      
             where 11<=age<=15;
            vline age/response=WEIGHT group=sexn grouporder=ascending stat=mean limitstat=stderr name="a"  markers;
			refline &LL/axis=y label="LLOQ=&ll" LABELLOC= INSIDE lineattrs= (pattern=2);
            xaxis type= linear GRID values=( 0 to 21 by 3);
            yaxis type=log  GRID values=( 1 10 50 100 200) display=all    logstyle=logexpand minor ;
            keylegend 'a'/noborder;
		
      run;

%MEND;
%c1(ALLTEST=test project,LL=20);
ods rtf CLOSE;


 

View solution in original post

1 REPLY 1
Reeza
Super User

Double quotes. Macro variables on resolve in double quotes,  not single quotes. 

 

Use single quotes if you have text that has an & or % sign in it . Otherwise, in double quotes, SAS will try to interpret that as a macro or macro variable. 

 


@magicdj wrote:

in sgplot, how to add macro variable in footnote?

I add macro variables in title and footnote, the title shows but footnote doesn't. I don't know why. anyone can help?

thanks a lot. below is my code.

test.jpg

proc sort data=sashelp.class out=class;
by sex;
run;

data c1;
  set class;
   if sex='M' then do; lloq=5.1; unit='mg/kg';sexn=1; end;
   if sex='F' then do; lloq=3; unit='mg/kg'; sexn=2; end;


run;



%MACRO ODS;
ods rtf file="c:\mean_plot.rtf"     STYLE=Styles.Stat     ;
%MEND;
%ODS;

%MACRO c1(ALLTEST,LL);

      TITLE H=1 font= 'Courier New' c=black "mean figure  of &ALLTEST";
 footnote H=1 j=l font= 'Courier New' c=black 'Notes: dotted line = LLOQ &LL';

      proc sgplot data=c1;
	      
             where 11<=age<=15;
            vline age/response=WEIGHT group=sexn grouporder=ascending stat=mean limitstat=stderr name="a"  markers;
			refline &LL/axis=y label="LLOQ=&ll" LABELLOC= INSIDE lineattrs= (pattern=2);
            xaxis type= linear GRID values=( 0 to 21 by 3);
            yaxis type=log  GRID values=( 1 10 50 100 200) display=all    logstyle=logexpand minor ;
            keylegend 'a'/noborder;
		
      run;

%MEND;
%c1(ALLTEST=test project,LL=20);
ods rtf CLOSE;


 

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
  • 1 reply
  • 2290 views
  • 0 likes
  • 2 in conversation