Date: Mon, 23 Apr 2001 23:31:10 +0100
Reply-To: roland.rashleigh-berry@virgin.net
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Roland <roland.rashleigh-berry@VIRGIN.NET>
Organization: N/A
Subject: Re: compress macro
Content-Type: text/plain; charset=us-ascii
That's not so good, however. It will remove all occurences of any of the
characters, which may not be what you want. You need to translate a
specific sequence of characters into nothing and there is no base
function that can do that that a %sysfunc can call. The macro I posted
in response to this request will do it.
Peter Crawford wrote:
>
> At a recent update of v6, SI introduced %sysfunc() to enable (most of)
> the functions of the base sas data step to be executed by the macro
> compiler ---
> for example I think this does what was wanted here
>
> %let reduced = %sysfunc( compress( &firstmvar, abc ));
>
> removes all letters a, b or c from var &firstvar to assign to &reduced
>
> Casey Pierce <casey@SDAC.HARVARD.EDU> writes
> >Before I reinvent the wheel, does anyone have a macro to compress
> >specified characters out of a macro variable value? What I'd like
> >to be able to do is, if I have a macro var TITLE = "PLA" Derivative,
> >then I could compress out the quotes for TITLE = PLA Derivative.
> >I have written this specifically for quotes, but was hoping someone
> >would like to share a generic macro for whatever character needs
> >removing.
> >
> > Thanks so much.
> >
> > -Casey
>
> --
> Peter Crawford
|