Date: Thu, 1 Mar 2012 16:57:14 -0500
Reply-To: Phil Rack <philrack@MINEQUEST.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Phil Rack <philrack@MINEQUEST.COM>
Subject: Stripping quotes off of text contained in a macro variable
I'm really struggling here and I hope someone can lend me a hand. I'm trying
to do some error checking and cleanup on some code. I have a macro that
takes a file name and checks to see if it exists and does some stuff if it
does. However, the user may enter the file name in the macro with quotes and
I want to be able to remove them before doing any processing.
Here is an example.
%macro getfile(fn=);
%put &fn;
%mend;
%getfile(fn=c:\temp\somefile.txt);
and returns: c:\temp\somefile.txt
if the user enters the value with quotes such as:
%getfile(fn="c:\temp\somefile.txt");
it returns: "c:\temp\somefile.txt"
I want the quotes stripped off so it returns:
c:\temp\somefile.txt
Any suggestions would be appreciated.
Thanks,
Phil Rack