Date: Sun, 24 Jun 2007 23:28:39 -0700
Reply-To: David L Cassell <davidlcassell@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David L Cassell <davidlcassell@MSN.COM>
Subject: Re: evaluating char var in data step
In-Reply-To: <200706222056.l5MJcMUo021832@mailgw.cc.uga.edu>
Content-Type: text/plain; format=flowed
cmiller1@COQIO.SDPS.ORG wrote:
>
>The macro below prints out the colors to the log.
>Is it possible to do the same from a data step?
>What I need apparently is some sort of evaluation
>function that returns the value of a character
>variable????
>Thanks much.
>
>
>%let c1=blue;
>%let c2=green;
>%let c3=fuschia;
>%let c4=chartruese;
>%let c5=paisley;
>
>
>%macro goo;
> %do k=1 %to 5;
> %put &&&c&k.;
> %end;
>%mend goo;
>%goo
>
>
>
>This fails with the error message shown.
>data zoo;
> n=1;
> do while(n<6);
> put n=;
> x = "c" || left(n);
> put &x;
> n+1;
> end;
>run;
>
>290 put &x;
> -
> 22
>WARNING: Apparent symbolic reference X not resolved.
>ERROR 22-322: Expecting a name.
>
>I am thinking there must be something like:
> put &value_of(x);
>??????????????
What are you *really* trying to do?
If you explain what your 'big picture' is, someone here can probably
give you a more informed answer. Right now it looks like you're
over-using macro variables, so it's hard to give you good advice.
HTH,
David
--
David L. Cassell
mathematical statistician
Design Pathways
3115 NW Norwood Pl.
Corvallis OR 97330
_________________________________________________________________
Who's that on the Red Carpet? Play & win glamorous prizes.
http://club.live.com/red_carpet_reveal.aspx?icid=REDCARPET_hotmailtextlink3