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 (May 2008, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 13 May 2008 17:51:56 -0400
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Susie C Y Li <>
Subject:      Re: Macro variable problem: year/month date value conversion
Comments: To:
In-Reply-To:  <>
Content-Type: text/plain; charset="us-ascii"

Thank you. Your fix worked.

Susie Chung Li

-----Original Message----- From: data _null_, [] Sent: Tuesday, May 13, 2008 5:34 PM To: Li,Susie MK BIP-US-R Cc: Subject: Re: Macro variable problem: year/month date value conversion

You can't do it that way using CALL SYMPUT and then trying to use the value in the same step. This may be more helpful to you...

%let endmo=1mar2008; data mic; trx=1; run; %macro test(dsn=); %let yyyymm = %sysfunc(intnx(month,"&endmo"d,0),yymmn6); %put NOTE YYYYMM=<&yyyymm>; data &dsn; set &dsn (rename=trx=&dsn._trx_&yyyymm); run; %mend;

options mprint; %test(dsn=mic);

You may want to consider an completely different approach. Keeping data in the meta data fields of a SAS data set does not make for the most efficient coding. We would need to see the big picture to make a more useful recommendation.

On 5/13/08, Susie C Y Li <> wrote: > Hello all, > > I would like to get a variable name "trx" changed to something like > "mic_200803" by running the following code. But it failed. Can you help? > > > ------- code ------ > > %let endmo=1mar2008; > %macro test(dsn=); > data &dsn; > sasdate=intnx('month',"endmo"d,0)); > call symput('yyyymm',put(sasdate,yymmn6.)); > set &dsn (rename=trx=&dsn._trx_&yyyymm); > run; > %mend; > > %test(dsn=mic); > > ----- log --------- > > MPRINT(RUNMARKET): ; > SYMBOLGEN: Macro variable DSN resolves to mic > MPRINT(RENAMEIT): data mic; > SYMBOLGEN: Macro variable ENDMO resolves to 01mar2008 > MPRINT(RENAMEIT): sasdate=intnx('month',"01mar2008"d,0); > MPRINT(RENAMEIT): call symput('yyyymm',put(sasdate,yymmn6.)); > SYMBOLGEN: Macro variable DSN resolves to mic > WARNING: Apparent symbolic reference YYYYMM not resolved. > > > > > Susie Chung Li >

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