|
I dont see where Macro var survey1 or survey2 is defined anywhere.
At the very least you would want to another parameter for passing your by
vars.
Lose the semicolon after your macro call it isnt needed.
Finally you need to learn how to back track problems. Start with yoru
macro, drop all the macro vars your passing and just call the macro without
them. If it still works then you know it is further up in your program, I
would then look at the macro vars you are passing to your parameters. Ifn;
it was me at that point I would dump the macro vars out in a %put statement
just before the macro call so I could see the the values I am passing. If
everything looks good there I would look at the code immediately preceding
the macro.
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: webonomic <webonomic@GMAIL.COM>
Reply-To: webonomic <webonomic@GMAIL.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Help with reusable Merge macro
Date: Thu, 11 Jan 2007 16:52:54 -0800
First question. In my Log, is there not a way to display the output of
macros instead of seeing the ¯oname.
Ie. If I did %let jane = 0; My log would show &jane but I want it to
show 0.
Second question:
I am running the following code:
%INCLUDE "C:\constants.sas";
%let data1 = a.&survey1; /* a is a libname in constants, as is the
survey1 and survey2 */
&let data2 = a.&survey2;
%merge_loc(ds1=&data1, ds2=&data2, resultdataset=d);
The macro merge_loc is in the constants.sas file and looks like this:
%MACRO merge_loc(ds1=, ds2=, resultdataset=);
proc sort data=&ds1;
by Site;
run;
proc sort data=&ds2;
by Site;
run;
data &resultdataset;
merge &ds1 &ds2;
by Site;
run;
%MEND merge_loc;
I know the actual code within the merge_loc works. It's something
about all the macros which isn't working. Anyone spot any mistakes?
My ultimate goal here is to create a reusable Merge macro.
_________________________________________________________________
Fixing up the home? Live Search can help
http://imagine-windowslive.com/search/kits/default.aspx?kit=improve&locale=en-US&source=hmemailtaglinenov06&FORM=WLMTAG
|