LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2007, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 11 Jan 2007 19:58:58 -0700
Reply-To:     Alan Churchill <SASL001@SAVIAN.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Alan Churchill <SASL001@SAVIAN.NET>
Subject:      Re: Help with reusable Merge macro
Comments: To: webonomic@GMAIL.COM
Comments: cc: toby dunn <tobydunn@HOTMAIL.COM>
In-Reply-To:  <BAY123-F13691C1CCBB9EBB2729809DEB00@phx.gbl>
Content-Type: text/plain; charset="iso-8859-1"

I would add 3 pet-peeve things:

- Indent code properly so it is more readable.

- Put in standardized comment blocks (if they aren't already there)

- If the memory is there, use a hash instead of a merge

Alan

Alan Churchill Savian "Bridging SAS and Microsoft Technologies" www.savian.net

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of toby dunn Sent: Thursday, January 11, 2007 6:26 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Help with reusable Merge macro

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 &macroname. 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.

_________________________________________________________________ Get FREE Web site and company branded e-mail from Microsoft Office Live http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/


Back to: Top of message | Previous page | Main SAS-L page