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 (November 2002, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 7 Nov 2002 18:31:06 +0100
Reply-To:     Peter Crawford <peter.crawford@DB.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Peter Crawford <peter.crawford@DB.COM>
Subject:      Re: Advice in writing an Utility Macro
Comments: To: "Gerstle, John" <yzg9@CDC.GOV>
Content-type: text/plain; charset=iso-8859-1

Hi John

ask yourself whether you need to work on variable values or variable names.

The macro compiler doesn't see values "in" observations.

A construct like %let var1 = %mac(3298); requires that %mac() does not generate code that would "go through a statement boundary".

Hope it's useful

Peter

Datum: 07/11/2002 17:20 An: SAS-L@LISTSERV.UGA.EDU

Antwort an: "Gerstle, John" <yzg9@CDC.GOV>

Betreff: Advice in writing an Utility Macro Nachrichtentext:

Folks,

I've been wrestling with a macro I've written that I need some direction. I want to figure this out myself to better my understanding of what I'm doing, so I'm going to save the code for right now and just ask a question or two.

When writing an utility macro, one that will provide a value for a simple 'var1 = %mac(var2);' statement within a data step instead of the macro creating new SAS code, what are the things you have to check and double check? I know that the semicolon after the value should not be there, but what else?

The main problem I'm having is that, while my macro will run in open code given an explicit value (i.e. %let var1 = %mac(3298); %put &var1; ) , when I try to use it within a datastep (i.e. var1 = %mac(var2);), where var2 has (character) values, the macro does not resolve properly - using the text of the variable name 'var2' as the value to use instead of the actual values of the variable 'var2'.

Does this question make since? If it does, can someone suggest what I may be doing wrong?

I think my problem is something little, like a mistake in quoting or not quoting.

John Gerstle Biostatistician CDC Information Technical Services (CITS) Contractor Support to NCHSTP Division of HIV/AIDS Prevention HIV/AIDS Incidence and Case Study Branch (HICSB) Phone: 404-639-3980 Fax: 404-639-2980 Cell: 770-639-5060 Email: jgerstle@cdc.gov

--

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


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