Date: Wed, 29 Jan 2003 12:22:41 +0100
Reply-To: Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Subject: Re: Help with Macro Resolution
Content-Type: text/plain; charset="iso-8859-1"
Hi John,
You did not show all your code, but from
SYMBOLGEN: Macro variable STARTMONTH resolves to '31Dec2002'd
is seems that your macro variable StartMonth already has the value as
appears.
This means that your macro statement
%let start="&StartMonth"d;
should be changed to
%let start=&StartMonth;
This is to begin with. I have not looked at other possible problems. Firstly
solve this problem and see what happens. Good luck.
Regards - Jim.
--
Y. (Jim) Groeneveld, MSc IMRO TRAMARKO tel. +31 412 407 070
senior statist./data man. P.O. Box 1 fax. +31 412 407 080
J.Groeneveld@ITGroups.com 5350 AA BERGHEM, NL www.imrotramarko.com
IF Annoying=T THEN Salutation=''; ELSE IF Sex='M' THEN Salutation='Hi'; ELSE
IF Sex='F' THEN Salutation='Dear'; ELSE Salutation='Hallo';
Notice of confidentiality: this e-mail may contain confidential information
intended for the addressed recipient only.
If you have received this e-mail in error please delete this e-mail and
please notify the sender so that proper delivery can be arranged.
> -----Original Message-----
> From: John Hewitt [mailto:john_hewitt2003@YAHOO.COM]
> Sent: 29 January 2003 11:58
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Help with Macro Resolution
>
>
> Dear All:
> Can anyone please help me understand why this macro does not resolve.
> I am trying to rearrange the order of variables in a dynamic
> dataset by using a retain statement but macro which
> identifies the variables does not resolve.
> The statements and log are give below.
> Thanks in advance for your help.
>
> John
>
>
> 715 %macro rearrange;
>
> 716
>
> 717 %let start="&StartMonth"d;
>
> 718
>
> 719 %do i=1 %to 2;
>
> 720
>
> 721 data _null_;
>
> 722 call symput('yyyymmm',put(intnx('month',&start,&&i-1),yymon7.));
>
> 723 run;
>
> 724 %put=&yyyymmm;
>
> 725 data Reports.zwav_ALL_test;
>
> 726 Retain
>
> 727 %do i= 1 %to 2;
>
> 728 Frequency&&yyyymmm&i. Cum_Fr_End_LastMonth Order_value&&yyyymmm&i.
>
> 729 Cum_Ord_Val_End_LastMonth Waiver_value&&yyyymmm&i.
> Cum_Wai_Val_End_LastMonth
>
> 730 %end;;
>
> 731 set Reports.zwav_ALL;
>
> 732 run;
>
> 733 %end;;
>
> 734 %mend rearrange;
>
> 735
>
> 736 %rearrange
>
> MLOGIC(REARRANGE): Beginning execution.
>
> MLOGIC(REARRANGE): %LET (variable name is START)
>
> SYMBOLGEN: Macro variable STARTMONTH resolves to '31Dec2002'd
>
> MLOGIC(REARRANGE): %DO loop beginning; index variable I;
> start value is 1; stop value is 2; by
>
> value is 1.
>
> MPRINT(REARRANGE): data _null_;
>
> SYMBOLGEN: Macro variable START resolves to "'31Dec2002'd"d
>
> SYMBOLGEN: && resolves to &.
>
> SYMBOLGEN: Macro variable I resolves to 1
>
> MPRINT(REARRANGE): call
> symput('yyyymmm',put(intnx('month',"'31Dec2002'd"d,1-1),yymon7.));
>
> MPRINT(REARRANGE): run;
>
> NOTE: DATA statement used:
>
> real time 0.00 seconds
>
>
>
> MLOGIC(REARRANGE): %PUT =&yyyymmm
>
> SYMBOLGEN: Macro variable YYYYMMM resolves to 2002DEC
>
> =2002DEC
>
> MPRINT(REARRANGE): data Reports.zwav_ALL_test;
>
> MLOGIC(REARRANGE): %DO loop beginning; index variable I;
> start value is 1; stop value is 2; by
>
> value is 1.
>
> SYMBOLGEN: && resolves to &.
>
> SYMBOLGEN: Macro variable I resolves to 1
>
> WARNING: Apparent symbolic reference YYYYMMM1 not resolved.
>
> SYMBOLGEN: && resolves to &.
>
> SYMBOLGEN: Macro variable I resolves to 1
>
> NOTE: Line generated by the macro variable "I".
>
> 1 Frequency&yyyymmm1
>
> -
>
> 22
>
> --------
>
> 202
>
> NOTE: Line generated by the macro variable "I".
>
> 1 Order_value&yyyymmm1
>
> -
>
> 22
>
> WARNING: Apparent symbolic reference YYYYMMM1 not resolved.
>
> SYMBOLGEN: && resolves to &.
>
> SYMBOLGEN: Macro variable I resolves to 1
>
> NOTE: Line generated by the macro variable "I".
>
> 1 Order_value&yyyymmm1
>
> --------
>
> 202
>
> ERROR 22-322: Syntax error, expecting one of the following: a
> name, a quoted string,
>
> a numeric constant, a datetime constant, a missing value, (,
> -, :, ;, _ALL_,
>
> _CHARACTER_, _CHAR_, _NUMERIC_.
>
> ERROR 202-322: The option or parameter is not recognized and
> will be ignored.
>
> WARNING: Apparent symbolic reference YYYYMMM1 not resolved.
>
> NOTE 138-205: Line generated by the macro variable "I".
>
> 1 Waiver_value&yyyymmm1
>
> -
>
> 22
>
> ERROR 22-322: Syntax error, expecting one of the following: a
> name, a quoted string,
>
> a numeric constant, a datetime constant, a missing value, (,
> -, :, ;, _ALL_,
>
> _CHARACTER_, _CHAR_, _NUMERIC_.
>
> MLOGIC(REARRANGE): %DO loop index variable I is now 2; loop
> will iterate again.
>
> SYMBOLGEN: && resolves to &.
>
> SYMBOLGEN: Macro variable I resolves to 2
>
> NOTE: Line generated by the macro variable "I".
>
> 1 Waiver_value&yyyymmm1
>
> --------
>
> 202
>
> ERROR 202-322: The option or parameter is not recognized and
> will be ignored.
>
> WARNING: Apparent symbolic reference YYYYMMM2 not resolved.
>
> SYMBOLGEN: && resolves to &.
>
> SYMBOLGEN: Macro variable I resolves to 2
>
> NOTE: Line generated by the macro variable "I".
>
> 1 Frequency&yyyymmm2
>
> -
>
> 22
>
> --------
>
> 202
>
> NOTE: Line generated by the macro variable "I".
>
> 1 Order_value&yyyymmm2
>
> -
>
> 22
>
> WARNING: Apparent symbolic reference YYYYMMM2 not resolved.
>
> SYMBOLGEN: && resolves to &.
>
> SYMBOLGEN: Macro variable I resolves to 2
>
> NOTE: Line generated by the macro variable "I".
>
> 1 Order_value&yyyymmm2
>
> --------
>
> 202
>
> ERROR 22-322: Syntax error, expecting one of the following: a
> name, a quoted string,
>
> a numeric constant, a datetime constant, a missing value, (,
> -, :, ;, _ALL_,
>
> _CHARACTER_, _CHAR_, _NUMERIC_.
>
> ERROR 202-322: The option or parameter is not recognized and
> will be ignored.
>
> WARNING: Apparent symbolic reference YYYYMMM2 not resolved.
>
> NOTE 138-205: Line generated by the macro variable "I".
>
> 1 Waiver_value&yyyymmm2
>
> -
>
> 22
>
> ERROR 22-322: Syntax error, expecting one of the following: a
> name, a quoted string,
>
> a numeric constant, a datetime constant, a missing value, (,
> -, :, ;, _ALL_,
>
> _CHARACTER_, _CHAR_, _NUMERIC_.
>
> MLOGIC(REARRANGE): %DO loop index variable I is now 3; loop
> will not iterate again.
>
> NOTE: Line generated by the macro variable "I".
>
> 1 Waiver_value&yyyymmm2
>
> --------
>
> 202
>
> ERROR 202-322: The option or parameter is not recognized and
> will be ignored.
>
> MPRINT(REARRANGE): Retain Frequency&yyyymmm1
> Cum_Fr_End_LastMonth Order_value&yyyymmm1
>
> Cum_Ord_Val_End_LastMonth Waiver_value&yyyymmm1
> Cum_Wai_Val_End_LastMonth Frequency&yyyymmm2
>
> Cum_Fr_End_LastMonth Order_value&yyyymmm2
> Cum_Ord_Val_End_LastMonth Waiver_value&yyyymmm2
>
> Cum_Wai_Val_End_LastMonth;
>
> MPRINT(REARRANGE): set Reports.zwav_ALL;
>
> MPRINT(REARRANGE): run;
>
> NOTE: The SAS System stopped processing this step because of errors.
>
> WARNING: The data set REPORTS.ZWAV_ALL_TEST may be
> incomplete. When this step was stopped there
>
> were 0 observations and 33 variables.
>
> WARNING: Data set REPORTS.ZWAV_ALL_TEST was not replaced
> because this step was stopped.
>
> NOTE: DATA statement used:
>
> real time 0.33 seconds
>
>
>
> MLOGIC(REARRANGE): %DO loop index variable I is now 4; loop
> will not iterate again.
>
> MPRINT(REARRANGE): ;
>
> MLOGIC(REARRANGE): Ending execution.
>
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now
>
|