LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (May 2002, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 23 May 2002 09:09:29 +0000
Reply-To:     dkb@CIX.COMPULINK.CO.UK
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         dkb@CIX.COMPULINK.CO.UK
Organization: Nextra UK
Subject:      Re: problems with %STR and quoting of quotation marks

Richard,

Try coding %PUT &BEGDATE to see what you have actually created in the macro variable?

You might find this approach simpler to read (I know I do!):

%let montxt = may; %let year=2002;

%LET BEGDATE=01&MONTXT.&YEAR;

DATA table; begloop = "&BEGDATE"d; endloop = intnx('MONTH',begloop,0,'E'); totrecs=.; DO rectype=1 to 11; DO chargedate=begloop to endloop; DO hour = 0 to 23; output; END; END; END; RUN;

Kind regards,

Dave

Richard Paterson asks:

> hi folks, > > can someone tell me what is wrong with the following quote. I have > narrowed it down to the BEGDATE and ENDDATE macro variables, but > cannot explain why a syntax error is being generated. If I hardcode in > the date values then it works. any help appreciated. > > thanks > > Richard > > > %let montxt = may; > %let year=2002; > > %LET next=%eval(%sysfunc(mdy(&month+1,01,&year))-1); > %LET lastday=%sysfunc(day(&next)); > > %LET begdate=%STR(%')01-&montxt-&year.%STR(%'); > %LET enddate=%STR(%')&lastday-&montxt-&year.%STR(%'); > > DATA table; > > begloop = input(&begdate,date11.); > endloop = input(&enddate,date11.); > * begloop = input('01-may-2002',date11.); > * endloop = input('31-may-2002',date11.); > put begloop= ; > put endloop= ; > totrecs=.; > DO rectype=1 to 11; > DO chargedate=begloop to endloop; > DO hour = 0 to 23; > output; > END; > END; > END; > RUN;

.


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