LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2012, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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


Back to: Top of message | Previous page | Main SAS-L page