Date: Mon, 16 Jul 2007 13:36:25 +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: ERROR : Macro Vairable NOT resolved
In-Reply-To: <403593359CA56C4CAE1F8F4F00DCFE7D0ACD4F03@MAILBE2.westat.com>
Content-Type: text/plain; format=flowed
Ed ,
Uhhh I was just trying to corect the problem without making changing how the
macro worked.
Now Ed since you went down this road lets keep on going a little further.
In all actuallity no macro is needed, just a format. Odds are the date
value is heald in a human readable format of yyyymmdd or yyyyddmm.
Okay so the above will solve the problem but is it the best, nope not at
all. Now if the date value is a SAS date value it becomes even easier by
simply using the IfC and Year function.
I am still curious as to how the macro var &Total_Val_1 is created and if it
can be derived from the data as well.
Toby Dunn
If anything simply cannot go wrong, it will anyway. Murphys Law #2.
The buddy system is essential to your survival; it gives the enemy somebody
else to shoot at.
Murphys Law #
Tell a man there are 300 billion stars in the universe and he'll believe
you. Tell him a bench has wet paint on it and he'll have to touch to be
sure. Murphys Law #9
From: Ed Heaton <EdHeaton@WESTAT.COM>
Reply-To: Ed Heaton <EdHeaton@WESTAT.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: ERROR : Macro Vairable NOT resolved
Date: Mon, 16 Jul 2007 09:18:14 -0400
Toby and whoever you are:
Maybe you should make your macro a function.
%macro fee_var(year) ;
%if %substr(&year,1,4)=2007
%then total_val ;
%else total_val_1 ;
%mEnd fee_var ;
Data temp_all ;
Merge
temp1( in=inTemp1 )
temp2(
in=inTemp2
keep= group_id account_idaum %fee_var(2004)
)
;
By group_id ;
If inTemp1 ;
Run ;
This way, you avoid the &FEE macro variable entirely and you
don't have to worry about whether it's local or global.
Ed
Edward Heaton, Senior Systems Analyst,
Westat (An Employee-Owned Research Corporation),
1650 Research Boulevard, RW-4541, Rockville, MD 20850-3195
Voice: (301) 610-4818 Fax: (301) 294-3879
mailto:EdHeaton@Westat.com http://www.Westat.com
Ed
Ed Heaton
RW-4541
#4818
-----Original Message-----
From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu]
On Behalf Of toby dunn
Sent: Friday, July 13, 2007 11:50 AM
To: mtamboli@GMAIL.COM; SAS-L@LISTSERV.UGA.EDU
Subject: RE: ERROR : Macro Vairable NOT resolved
Macro var Fee is local to your %MAcro. Add %Global Fee to your %Macro
definition and it should be okay.
Toby Dunn
If anything simply cannot go wrong, it will anyway. Murphys Law #2.
The buddy system is essential to your survival; it gives the enemy
somebody
else to shoot at.
Murphys Law #
Tell a man there are 300 billion stars in the universe and he'll believe
you. Tell him a bench has wet paint on it and he'll have to touch to be
sure. Murphys Law #9
From: Tamboli <mtamboli@GMAIL.COM>
Reply-To: Tamboli <mtamboli@GMAIL.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: ERROR : Macro Vairable NOT resolved
Date: Fri, 13 Jul 2007 08:41:37 -0700
Hello,
I am getting an ERROR as a result of the macro variable not been
resolved. I would appreacite if any one could help me on this.
Here is the snippet of the code. The macro variable is not resolved
during the merge as a result of
which resulting in an error.
Thanks
%macro fee_var;
%if %substr(&year,1,4)=2007 %then %let fee = total_val;
%else %let fee = total_val_1;
%mend;
%fee_var
data temp_all;
merge temp1 (in = a)
temp2 (in = b
keep = group_id
account_id
aum
&fee);
BY GROUP_ID;
if (a);
run;
_________________________________________________________________
http://newlivehotmail.com
_________________________________________________________________
http://liveearth.msn.com