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 2025: Call for Content

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!

Submit your idea!

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