Date: Thu, 15 Mar 2007 18:32:20 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: macro resolves to a different value
In-Reply-To: <200703151811.l2FGsx3O021849@mailgw.cc.uga.edu>
Content-Type: text/plain; format=flowed
First off I am not fond of the Macro design, that asside you will never get
the last %Put to work because you havent declared your macro variable Type
created in your %Macro as global. thus it will always be local to your
%macro. Since your %Put is asking for a global macro variable, the two dont
mix.
If it where me and I absolutly had to do this try this function style macro
design:
%Macro ConvertType( Type= ) ;
%Local NewType ;
%If ( &Type = 0 ) %Then %Let NewType = Draw ;
%Else %If ( &Type = 1 ) %Then %Let NewType = Sale ;
%Else %If ( &Type = 2 ) %Then %Let NewType = Issu ;
&Newtype
%Mend ConvertType ;
%Put %ConvertType( Type = 0 ) ;
%Put %ConvertType( Type = 1 ) ;
%Put %ConvertType( Type = 2 ) ;
Toby Dunn
To sensible men, every day is a day of reckoning. ~John W. Gardner
The important thing is this: To be able at any moment to sacrifice that
which we are for what we could become. ~Charles DuBois
Don't get your knickers in a knot. Nothing is solved and it just makes you
walk funny. ~Kathryn Carpenter
From: mesecca L katram <mesecca@YAHOO.COM>
Reply-To: mesecca L katram <mesecca@YAHOO.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: macro resolves to a different value
Date: Thu, 15 Mar 2007 14:11:59 -0400
my macro always resolves to issu,
please help
options mprint mlogic;
%let data5=0;
%macro gettype(data5);
data _null_;
y = trim(left(put(symget('data5'),8.)));
call symput('typ',y);
run;
%put &typ;
data _null_;
if %eval(&typ)=0 then do;%let type=DRAW;end;
if %eval(&typ)=1 then do;%let type=SALE;end;
if %eval(&typ)=2 then do;%let type=ISSU;end;
run;
%mend;
%gettype(&data5);
run;
%put &type;
_________________________________________________________________
Mortgage rates as low as 4.625% - Refinance $150,000 loan for $579 a month.
Intro*Terms
https://www2.nextag.com/goto.jsp?product=100000035&url=%2fst.jsp&tm=y&search=mortgage_text_links_88_h27f6&disc=y&vers=743&s=4056&p=5117