Data visualization with SAS programming

Problem with ODS from SGRENDER in a macro

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 12
Accepted Solution

Problem with ODS from SGRENDER in a macro

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


Accepted Solutions
Solution
‎02-26-2016 11:25 AM
SAS Super FREQ
Posts: 3,406

Re: Problem with ODS from SGRENDER in a macro

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


All Replies
Solution
‎02-26-2016 11:25 AM
SAS Super FREQ
Posts: 3,406

Re: Problem with ODS from SGRENDER in a macro

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

IMAGENAME = "&fname. Recurrence Plot";

Occasional Contributor
Posts: 12

Re: Problem with ODS from SGRENDER in a macro

Thanks! I forgot that rule.
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 304 views
  • 1 like
  • 2 in conversation