|
Pat the following throws a warning but will get you what you want I
think:
%let ay = 2001-2002;
%let ay2 = %sysfunc(compress(%substr(&ay,1,(%eval(%index(&ay,-)-1)))_
%substr(&ay,%eval(%index(&ay,-)+1),%length(&ay))));
%put &ay2;
HTH
Toby Dunn
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Pat
Moore
Sent: Thursday, July 15, 2004 2:44 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Change text in a macro variable
SAS Gurus,
I have a variable called ay which looks like this: 2001-2002. I want
to
use it as part of a filename, so I need to get rid of the hyphen or
(preferably) replace the hyphen with an underline. I'm doing this in a
macro, so I need a step that does something like this:
data &c&cno&(translate(&ay,'-','_'));
set etc...
So that the macro creates a filename like:
data ART1022001_2002;
How does one accomplish this feat?
Pat Moore
|