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

Hi all,

 

I'm attempting to write a macro that gathers data from a text file, graphs it, then saves the graph. My problem is in the saving graph bit. Here the relevant code:

 

 

%MACRO rpz2 (fname=, radius=);
	%let fname_len = %length(&fname);
	%let subjname = %substr(&fname, 1, &fname_len-3);
	%let rad_rr = 20;
	%let rad_z2 = 25;

	DATA &fname;
		INFILE "C:\Users\Benjamin\Data\HeatMappers\Txts\&fname..txt"
			DELIMITER='    ' ;
		INPUT X Y Recurrence;
	RUN;

	DATA &fname;
		set &fname;
		if recurrence > &radius THEN delete;
	RUN;

	ods printer printer=tiff;
	ODS GRAPHICS / IMAGENAME = '&fname. Recurrence Plot';
		proc sgrender data=&fname template=PlotRadius&radius; 
		dynamic _X='X' _Y='Y' _Z='Recurrence' _T="Plot - &fname";
	   	TITLE "Plot";
	RUN;
	ods printer close;

%MEND rpz2 ;

I keep getting a message that reads "WARNING: The IMAGENAME option or the output name contains invalid characters. _fname Recurrence Plot will be used as the image name prefix." Then it saves a file in the right directory, but the problem is that the title of the file is "_fname Plot".

 

Thanks for the help!

Ben

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Use double quotes if you want to substitute the value of a macro variable into a string. For example

IMAGENAME = "&fname. Recurrence Plot";

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

Use double quotes if you want to substitute the value of a macro variable into a string. For example

IMAGENAME = "&fname. Recurrence Plot";

benbuck
Obsidian | Level 7
Thanks! I forgot that rule.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 1463 views
  • 1 like
  • 2 in conversation