Date: Mon, 10 Feb 2003 19:26:42 -0000
Reply-To: Roland <roland@RASHLEIGH-BERRY.FSNET.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Roland <roland@RASHLEIGH-BERRY.FSNET.CO.UK>
Subject: Re: utility macro for returning a compressed string
1 %let macvar=aaa:bbb:ccc;
2 %put &macvar;
aaa:bbb:ccc
3 %let macvar=%sysfunc(compress(&macvar,:));
4 %put &macvar;
aaabbbccc
"Kevin Auslander" <kauslander@TERRECRS.COM> wrote in message
news:002c01c2d134$5b5e81a0$6a00a8c0@crs.local...
> I need a utility macro that will compress a the value of a macro
> variable. It would be used like this:
>
> %let var=%compress(&var,:);
>
> After this statement executes I would want var to equal it's previous
> value with all colons removed. %compress would work just like the data
> step compress function. Below is my attempt at writing this utility
> macro. It does not work. Does anyone know what's wrong? Am I on the
> right track?
>
> %macro compress(var,chars);
>
> data _null_;
> length var $30000;
> var = "&var."
> var = compress("&var.","&chars.");
> call symput("var",var);
> run;
>
> %sysfunc(putc(&var,$30000.));
>
> %mend;
>
> TIA,
>
> Kevin
|