| Date: | Fri, 28 Jul 2000 13:46:43 -0400 |
| Reply-To: | "Fehd, Ronald J." <rjf2@CDC.GOV> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Fehd, Ronald J." <rjf2@CDC.GOV> |
| Subject: | Re: Macro - Help requested please |
| Content-Type: | text/plain; charset="iso-8859-1" |
|---|
> From: erpadmin@MY-DEJA.COM [mailto:erpadmin@MY-DEJA.COM]
> I use the following code in a macro that runs correctly, plus
> in second
> of two %DO-loops: (all macrovariables are resolved correctly)
>
> data &&var&y. (keep=dset name00 varvalue) ;
> set &lib..&&dset&i. ;
> length varvalue $100 dset name00 $8 ;
> name00="&&var&y." ;
> dset="&&dset&i." ;
> ? if "&type."="N" then varvalue=put(&&var&y.,8.) ;
> ? else if "&type."="C" then varvalue=&&var&y. ;
> output ;
> run ;
>
> I noticed that the lines of code with questionmarks are not executed
> properly. Whichever value &type is assigned, it's always the ELSE part
> that is executed. I'm at a loss, I can't find why it won't evaluate
> correctly! Does any know what I'm doing wrong? Help will be very much
> appreciated.
I'll guess that you are using the variable Type from a proc CONTENTS output
data set
which is numeric and has values in (1=Numeric,2=Character)
try this:
if &type.=1 then varvalue=put(&&var&y.,8.) ;
else if &type.=2 then varvalue=&&var&y. ;
Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov
---> cheerful provider of UNTESTED SAS code!*! <---
archives: http://www.listserv.uga.edu/archives/sas-l.html
|