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 (December 1996, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 11 Dec 1996 23:14:31 -0500
Reply-To:     rcoleman@worldnet.att.net
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Ron Coleman <rcoleman@WORLDNET.ATT.NET>
Organization: Links Analytical, Inc.
Subject:      Re: macro question
Content-Type: text/plain; charset=us-ascii

Your problem comes from the fact that the macro variables are rectified before the DATA step ever executes. In other words, a macro variable that you set within a DATA step cannot be accessed until after a RUN or another PROC/DATA step begins.

You can use the macro %PUT to examine the date values you are setting.

DATA ...; lots of exciting code ...; RUN;

%PUT &bday;

Have fun with it! --------------------------------------------------------------- Machiko Hollifield wrote: > > Hi everyone, > I have a problem with macro program. I cannot create a macro variable > using "call symput". Is anyone help me where did I do wrong. > What I'm trying to do is move the sas variable (date) to macro variable. > This is the output. > > Thank you for your help. > > Machiko Hollifield > > P.S. Since we are stack with "trn" as a news reader and it's very hard > to find the mail through it, if you can send me reply directly to me > instead of the group, I really appriciate it. > > By the way, is anyone has good primer of "trn"? At Southern Methodist > University, they don't supply any course or handout. > **************************output*************************************** > MPRINT(MONTHLY): * THIS MACRO CALCULATE LAST DAY OF THE MONTH. THEN > FIND THE F > SATURDAY TO FRIDAY * THE INPUT DATA SHOULD BE THE TODAY''S DATE EITHER * > TODAY() > REPORT SHOULD BE COVER *; > MPRINT(MONTHLY): DATA _NULL_; > MPRINT(MONTHLY): RDATE = TODAY()-15; > MPRINT(MONTHLY): LBEGIN = '01'|| SUBSTR(PUT(RDATE,DATE9.),3); > MPRINT(MONTHLY): NBEGIN = INPUT(LBEGIN,DATE10.); > MPRINT(MONTHLY): CALL SYMPUT('bday',PUT(NBEGIN,MMDDYY10.)); > MPRINT(MONTHLY): THISMON = '01'|| SUBSTR(PUT(TODAY(),DATE9.),3); > MPRINT(MONTHLY): LEND = INPUT(THISMON,DATE10.) - 1; > MPRINT(MONTHLY): CALL SYMPUT('eday',PUT(LEND,MMDDYY10.)); > MPRINT(MONTHLY): PUT _ALL_; > MLOGIC(MONTHLY): %PUT &bday = &eday= > WARNING: Apparent symbolic reference BDAY not resolved. > WARNING: Apparent symbolic reference EDAY not resolved. > &bday = &eday= > MPRINT(MONTHLY): * CALL SYMPUT('BDAY',PUT(BEGIN,MMDDYY10.)); > MPRINT(MONTHLY): * CALL SYMPUT('EDAY',PUT(END,MMDDYY10.)); > MLOGIC(MONTHLY): Ending execution. > > RDATE=13479 LBEGIN=01NOV1996 NBEGIN=13454 THISMON=01DEC1996 LEND=13483 > _ERROR_=0 > > **********************************************************************

-- Ron Coleman Links Analytical, Inc. Linking your data to your business! 3545-1 St. Johns Bluff Rd. Suite 300 Jacksonville FL 32224 rcoleman@worldnet.att.net


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