From: Tom Abernathy on
The member name in the DICTIONARY.TABLES metadata is all uppercase. So
you are not getting any hits in you SQL query and this will cause the
macro variable NUM to not be defined.


On Jul 27, 11:09 am, stats analysis <statsfor...(a)gmail.com> wrote:
> On Jul 26, 10:13 pm, Arthur Tabachneck <art...(a)netscape.net> wrote:
>
>
>
>
>
> > Lou,
>
> > Since the code apparently comes from this paper:http://www2.sas.com/proceedings/sugi30/206-30.pdf
>
> > I'd say you were right on.
>
> > Art
> > ---------------
> > On Jul 26, 7:51 pm, "Lou" <lpog...(a)hotmail.com> wrote:
>
> > > "stats analysis" <statsfor...(a)gmail.com> wrote in message
>
> > >news:1c2c4db0-6e87-4913-b52b-83b1a1ce8732(a)w12g2000yqj.googlegroups.com....
>
> > > > Hi All,
>
> > > > I am trying to run the following macro which is taken from one of the
> > > > SAS SUG. I am getting some errors though (which I have pasted below
> > > > the code). One of them is that libname diction is not assigned. I
> > > > tried using my own libname but that didn't work. Any idea of what the
> > > > from statement is referring to? any help would be greatly appreciated.
> > > > Thanks!!
>
> > > > Options Mprint SYMBOLGEN MLOGIC;
> > > > %MACRO SCORE;
>
> > > > proc sql noprint;
> > > > select (nobs-delobs) into:num
> > > > from diction.tables
> > > > where libname='work'
> > > > and memname="Best_SUBSETS";
> > > > %let num=&num;
> > > > quit;
>
> > > > %do i=1 %to &num;
>
> > > > data_null_;
> > > > set Best_SUBSETS;
> > > > if _N_=&i;
> > > > call symput ('list', VariablesInModel);
> > > > run;
>
> > > > proc phreg data= mydata;
> > > > model eventnscf1=&list;
> > > > run;
> > > > %end;
> > > > %mend;
> > > > %score;
>
> > > > --------------------------------------------------------------------------
> > > ------------
> > > > These are the errors:
>
> > > > ERROR: Libname DICTION is not assigned.
> > > > MLOGIC(SCORE):  %LET (variable name is NUM)
> > > > WARNING: Apparent symbolic reference NUM not resolved.
> > > > ERROR: The text expression &NUM contains a recursive reference to the
> > > > macro variable NUM.  The
> > > >        macro variable will be assigned the null value.
> > > > MPRINT(SCORE):   quit;
> > > > NOTE: The SAS System stopped processing this step because of errors..
> > > > NOTE: PROCEDURE SQL used (Total process time):
> > > >       real time           0.00 seconds
> > > >       cpu time            0.00 seconds
>
> > > > SYMBOLGEN:  Macro variable NUM resolves to
> > > > ERROR: %EVAL function has no expression to evaluate, or %IF statement
> > > > has no condition.
> > > > ERROR: The %TO value of the %DO I loop is invalid.
> > > > ERROR: The macro SCORE will stop executing.
> > > > MLOGIC(SCORE):  Ending execution.
>
> > > Instead of DICTION, it probably should say:
>
> > > FROM DICTIONARY.TABLES
>
> > > At least, the SQL code will run without issuing an error message.  Without
> > > seeing the paper, what's supposed to be in dataset BEST_SUBSETS is anybody's
> > > guess.- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -
>
> Thank you all for your response.
> I created the Best_Subsets dataset which includes scores as mentioned
> in the paper. I was first getting that dictionary.tables is long so I
> cut it to diction. I put it back to dictionary now. and this is the
> set of errors I get. I am not sure how to resolve the &num error. it
> is the symbol "and" as mentioned in the paper.
>
> ERROR: The text expression &NUM contains a recursive reference to the
> macro variable NUM.  The
>        macro variable will be assigned the null value.
> MPRINT(SCORE):   quit;
> NOTE: The SAS System stopped processing this step because of errors.
> NOTE: PROCEDURE SQL used (Total process time):
>       real time           0.00 seconds
>       cpu time            0.00 seconds
>
> SYMBOLGEN:  Macro variable NUM resolves to
> ERROR: %EVAL function has no expression to evaluate, or %IF statement
> has no condition.
> ERROR: The %TO value of the %DO I loop is invalid.
> ERROR: The macro SCORE will stop executing.
> MLOGIC(SCORE):  Ending execution.
>
> thanks

From: stats analysis on
On Jul 27, 11:04 am, Tom Abernathy <tom.aberna...(a)gmail.com> wrote:
> The member name in the DICTIONARY.TABLES metadata is all uppercase. So
> you are not getting any hits in you SQL query and this will cause the
> macro variable NUM to not be defined.
>
> On Jul 27, 11:09 am, stats analysis <statsfor...(a)gmail.com> wrote:
>
>
>
> > On Jul 26, 10:13 pm, Arthur Tabachneck <art...(a)netscape.net> wrote:
>
> > > Lou,
>
> > > Since the code apparently comes from this paper:http://www2.sas.com/proceedings/sugi30/206-30.pdf
>
> > > I'd say you were right on.
>
> > > Art
> > > ---------------
> > > On Jul 26, 7:51 pm, "Lou" <lpog...(a)hotmail.com> wrote:
>
> > > > "stats analysis" <statsfor...(a)gmail.com> wrote in message
>
> > > >news:1c2c4db0-6e87-4913-b52b-83b1a1ce8732(a)w12g2000yqj.googlegroups.com...
>
> > > > > Hi All,
>
> > > > > I am trying to run the following macro which is taken from one of the
> > > > > SAS SUG. I am getting some errors though (which I have pasted below
> > > > > the code). One of them is that libname diction is not assigned. I
> > > > > tried using my own libname but that didn't work. Any idea of what the
> > > > > from statement is referring to? any help would be greatly appreciated.
> > > > > Thanks!!
>
> > > > > Options Mprint SYMBOLGEN MLOGIC;
> > > > > %MACRO SCORE;
>
> > > > > proc sql noprint;
> > > > > select (nobs-delobs) into:num
> > > > > from diction.tables
> > > > > where libname='work'
> > > > > and memname="Best_SUBSETS";
> > > > > %let num=&num;
> > > > > quit;
>
> > > > > %do i=1 %to &num;
>
> > > > > data_null_;
> > > > > set Best_SUBSETS;
> > > > > if _N_=&i;
> > > > > call symput ('list', VariablesInModel);
> > > > > run;
>
> > > > > proc phreg data= mydata;
> > > > > model eventnscf1=&list;
> > > > > run;
> > > > > %end;
> > > > > %mend;
> > > > > %score;
>
> > > > > --------------------------------------------------------------------------
> > > > ------------
> > > > > These are the errors:
>
> > > > > ERROR: Libname DICTION is not assigned.
> > > > > MLOGIC(SCORE):  %LET (variable name is NUM)
> > > > > WARNING: Apparent symbolic reference NUM not resolved.
> > > > > ERROR: The text expression &NUM contains a recursive reference to the
> > > > > macro variable NUM.  The
> > > > >        macro variable will be assigned the null value.
> > > > > MPRINT(SCORE):   quit;
> > > > > NOTE: The SAS System stopped processing this step because of errors.
> > > > > NOTE: PROCEDURE SQL used (Total process time):
> > > > >       real time           0.00 seconds
> > > > >       cpu time            0.00 seconds
>
> > > > > SYMBOLGEN:  Macro variable NUM resolves to
> > > > > ERROR: %EVAL function has no expression to evaluate, or %IF statement
> > > > > has no condition.
> > > > > ERROR: The %TO value of the %DO I loop is invalid.
> > > > > ERROR: The macro SCORE will stop executing.
> > > > > MLOGIC(SCORE):  Ending execution.
>
> > > > Instead of DICTION, it probably should say:
>
> > > > FROM DICTIONARY.TABLES
>
> > > > At least, the SQL code will run without issuing an error message.  Without
> > > > seeing the paper, what's supposed to be in dataset BEST_SUBSETS is anybody's
> > > > guess.- Hide quoted text -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -
>
> > Thank you all for your response.
> > I created the Best_Subsets dataset which includes scores as mentioned
> > in the paper. I was first getting that dictionary.tables is long so I
> > cut it to diction. I put it back to dictionary now. and this is the
> > set of errors I get. I am not sure how to resolve the &num error. it
> > is the symbol "and" as mentioned in the paper.
>
> > ERROR: The text expression &NUM contains a recursive reference to the
> > macro variable NUM.  The
> >        macro variable will be assigned the null value.
> > MPRINT(SCORE):   quit;
> > NOTE: The SAS System stopped processing this step because of errors.
> > NOTE: PROCEDURE SQL used (Total process time):
> >       real time           0.00 seconds
> >       cpu time            0.00 seconds
>
> > SYMBOLGEN:  Macro variable NUM resolves to
> > ERROR: %EVAL function has no expression to evaluate, or %IF statement
> > has no condition.
> > ERROR: The %TO value of the %DO I loop is invalid.
> > ERROR: The macro SCORE will stop executing.
> > MLOGIC(SCORE):  Ending execution.
>
> > thanks- Hide quoted text -
>
> - Show quoted text -

Thank you Tom,
I did try it in upper and lower case. I get the same error in both
situations.
My understanding is that SAS is not case sensitive. any additional
ideas of why this is happening.
thanks,
From: stats analysis on
On Jul 27, 11:11 am, stats analysis <statsfor...(a)gmail.com> wrote:
> On Jul 27, 11:04 am, Tom Abernathy <tom.aberna...(a)gmail.com> wrote:
>
>
>
>
>
> > The member name in the DICTIONARY.TABLES metadata is all uppercase. So
> > you are not getting any hits in you SQL query and this will cause the
> > macro variable NUM to not be defined.
>
> > On Jul 27, 11:09 am, stats analysis <statsfor...(a)gmail.com> wrote:
>
> > > On Jul 26, 10:13 pm, Arthur Tabachneck <art...(a)netscape.net> wrote:
>
> > > > Lou,
>
> > > > Since the code apparently comes from this paper:http://www2.sas.com/proceedings/sugi30/206-30.pdf
>
> > > > I'd say you were right on.
>
> > > > Art
> > > > ---------------
> > > > On Jul 26, 7:51 pm, "Lou" <lpog...(a)hotmail.com> wrote:
>
> > > > > "stats analysis" <statsfor...(a)gmail.com> wrote in message
>
> > > > >news:1c2c4db0-6e87-4913-b52b-83b1a1ce8732(a)w12g2000yqj.googlegroups..com...
>
> > > > > > Hi All,
>
> > > > > > I am trying to run the following macro which is taken from one of the
> > > > > > SAS SUG. I am getting some errors though (which I have pasted below
> > > > > > the code). One of them is that libname diction is not assigned. I
> > > > > > tried using my own libname but that didn't work. Any idea of what the
> > > > > > from statement is referring to? any help would be greatly appreciated.
> > > > > > Thanks!!
>
> > > > > > Options Mprint SYMBOLGEN MLOGIC;
> > > > > > %MACRO SCORE;
>
> > > > > > proc sql noprint;
> > > > > > select (nobs-delobs) into:num
> > > > > > from diction.tables
> > > > > > where libname='work'
> > > > > > and memname="Best_SUBSETS";
> > > > > > %let num=&num;
> > > > > > quit;
>
> > > > > > %do i=1 %to &num;
>
> > > > > > data_null_;
> > > > > > set Best_SUBSETS;
> > > > > > if _N_=&i;
> > > > > > call symput ('list', VariablesInModel);
> > > > > > run;
>
> > > > > > proc phreg data= mydata;
> > > > > > model eventnscf1=&list;
> > > > > > run;
> > > > > > %end;
> > > > > > %mend;
> > > > > > %score;
>
> > > > > > --------------------------------------------------------------------------
> > > > > ------------
> > > > > > These are the errors:
>
> > > > > > ERROR: Libname DICTION is not assigned.
> > > > > > MLOGIC(SCORE):  %LET (variable name is NUM)
> > > > > > WARNING: Apparent symbolic reference NUM not resolved.
> > > > > > ERROR: The text expression &NUM contains a recursive reference to the
> > > > > > macro variable NUM.  The
> > > > > >        macro variable will be assigned the null value.
> > > > > > MPRINT(SCORE):   quit;
> > > > > > NOTE: The SAS System stopped processing this step because of errors.
> > > > > > NOTE: PROCEDURE SQL used (Total process time):
> > > > > >       real time           0.00 seconds
> > > > > >       cpu time            0.00 seconds
>
> > > > > > SYMBOLGEN:  Macro variable NUM resolves to
> > > > > > ERROR: %EVAL function has no expression to evaluate, or %IF statement
> > > > > > has no condition.
> > > > > > ERROR: The %TO value of the %DO I loop is invalid.
> > > > > > ERROR: The macro SCORE will stop executing.
> > > > > > MLOGIC(SCORE):  Ending execution.
>
> > > > > Instead of DICTION, it probably should say:
>
> > > > > FROM DICTIONARY.TABLES
>
> > > > > At least, the SQL code will run without issuing an error message.  Without
> > > > > seeing the paper, what's supposed to be in dataset BEST_SUBSETS is anybody's
> > > > > guess.- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > > > - Show quoted text -
>
> > > Thank you all for your response.
> > > I created the Best_Subsets dataset which includes scores as mentioned
> > > in the paper. I was first getting that dictionary.tables is long so I
> > > cut it to diction. I put it back to dictionary now. and this is the
> > > set of errors I get. I am not sure how to resolve the &num error. it
> > > is the symbol "and" as mentioned in the paper.
>
> > > ERROR: The text expression &NUM contains a recursive reference to the
> > > macro variable NUM.  The
> > >        macro variable will be assigned the null value.
> > > MPRINT(SCORE):   quit;
> > > NOTE: The SAS System stopped processing this step because of errors.
> > > NOTE: PROCEDURE SQL used (Total process time):
> > >       real time           0.00 seconds
> > >       cpu time            0.00 seconds
>
> > > SYMBOLGEN:  Macro variable NUM resolves to
> > > ERROR: %EVAL function has no expression to evaluate, or %IF statement
> > > has no condition.
> > > ERROR: The %TO value of the %DO I loop is invalid.
> > > ERROR: The macro SCORE will stop executing.
> > > MLOGIC(SCORE):  Ending execution.
>
> > > thanks- Hide quoted text -
>
> > - Show quoted text -
>
> Thank you Tom,
> I did try it in upper and lower case. I get the same error in both
> situations.
> My understanding is that SAS is not case sensitive. any additional
> ideas of why this is happening.
> thanks,- Hide quoted text -
>
> - Show quoted text -

Oh yes. Tom I think you are right. I had the Best_subsets and work
libname in lower case. When I changed those to upper case it ran:
so now I have the following error: which is in the &list. any ideas?
thanks much...

49 ! roc phreg data= areds.eventsadd; model eventnscf1= &list; run;
-
22
200
MPRINT(SCORE): proc phreg data=;
WARNING: Apparent symbolic reference LIST not resolved.
MPRINT(SCORE): model eventnscf1= &list run;

ERROR 22-322: Syntax error, expecting one of the following: a
name, ;, /, _CHARACTER_, _CHAR_,
_NUMERIC_.

ERROR 200-322: The symbol is not recognized and will be ignored.


NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PHREG used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

MLOGIC(SCORE): %DO loop index variable I is now 24; loop will iterate
again.
MPRINT(SCORE): data_null_;
MPRINT(SCORE): set Best_SUBSETS;
SYMBOLGEN: Macro variable I resolves to 24
MPRINT(SCORE): if _N_=24;
MPRINT(SCORE): call symput ('list', VariablesInModel);
MPRINT(SCORE): run;


NOTE: Line generated by the invoked macro "SCORE".
51
p
51 ! roc phreg data= areds.eventsadd; model eventnscf1= &list; run;
-
22
200
MPRINT(SCORE): proc phreg data=;
WARNING: Apparent symbolic reference LIST not resolved.
MPRINT(SCORE): model eventnscf1= &list run;

ERROR 22-322: Syntax error, expecting one of the following: a
name, ;, /, _CHARACTER_, _CHAR_,
_NUMERIC_.

ERROR 200-322: The symbol is not recognized and will be ignored.


NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PHREG used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

MLOGIC(SCORE): %DO loop index variable I is now 25; loop will not
iterate again.
MLOGIC(SCORE): Ending execution.
From: stats analysis on
Oh yes. Tom I think you are right. I had the Best_subsets and work
libname in lower case. When I changed those to upper case it ran:
so now I have the following error: which is in the &list. any ideas?
thanks much...

49 ! roc phreg data= areds.eventsadd; model eventnscf1= &list; run;
-
22
200
MPRINT(SCORE): proc phreg data=;
WARNING: Apparent symbolic reference LIST not resolved.
MPRINT(SCORE): model eventnscf1= &list run;

ERROR 22-322: Syntax error, expecting one of the following: a
name, ;, /, _CHARACTER_, _CHAR_,
_NUMERIC_.

ERROR 200-322: The symbol is not recognized and will be ignored.


NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PHREG used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

MLOGIC(SCORE): %DO loop index variable I is now 24; loop will iterate
again.
MPRINT(SCORE): data_null_;
MPRINT(SCORE): set Best_SUBSETS;
SYMBOLGEN: Macro variable I resolves to 24
MPRINT(SCORE): if _N_=24;
MPRINT(SCORE): call symput ('list', VariablesInModel);
MPRINT(SCORE): run;


NOTE: Line generated by the invoked macro "SCORE".
51
p
51 ! roc phreg data= areds.eventsadd; model eventnscf1= &list; run;
-
22
200
MPRINT(SCORE): proc phreg data=;
WARNING: Apparent symbolic reference LIST not resolved.
MPRINT(SCORE): model eventnscf1= &list run;

ERROR 22-322: Syntax error, expecting one of the following: a
name, ;, /, _CHARACTER_, _CHAR_,
_NUMERIC_.

ERROR 200-322: The symbol is not recognized and will be ignored.


NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PHREG used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

MLOGIC(SCORE): %DO loop index variable I is now 25; loop will not
iterate again.
MLOGIC(SCORE): Ending execution.


From: stats analysis on
On Jul 27, 11:19 am, stats analysis <statsfor...(a)gmail.com> wrote:
> Oh yes. Tom I think you are right. I had the Best_subsets and work
> libname in lower case. When I changed those to upper case it ran:
> so now I have the following error: which is in the &list. any ideas?
> thanks much...
>
> 49  ! roc phreg data= areds.eventsadd; model eventnscf1= &list; run;
>                                                          -
>                                                          22
>                                                          200
> MPRINT(SCORE):   proc phreg data=;
> WARNING: Apparent symbolic reference LIST not resolved.
> MPRINT(SCORE):   model eventnscf1= &list run;
>
> ERROR 22-322: Syntax error, expecting one of the following: a
> name, ;, /, _CHARACTER_, _CHAR_,
>               _NUMERIC_.
>
> ERROR 200-322: The symbol is not recognized and will be ignored.
>
> NOTE: The SAS System stopped processing this step because of errors.
> NOTE: PROCEDURE PHREG used (Total process time):
>       real time           0.01 seconds
>       cpu time            0.01 seconds
>
> MLOGIC(SCORE):  %DO loop index variable I is now 24; loop will iterate
> again.
> MPRINT(SCORE):   data_null_;
> MPRINT(SCORE):   set Best_SUBSETS;
> SYMBOLGEN:  Macro variable I resolves to 24
> MPRINT(SCORE):   if _N_=24;
> MPRINT(SCORE):   call symput ('list', VariablesInModel);
> MPRINT(SCORE):   run;
>
> NOTE: Line generated by the invoked macro "SCORE".
> 51
> p
> 51  ! roc phreg data= areds.eventsadd; model eventnscf1= &list; run;
>                                                          -
>                                                          22
>                                                          200
> MPRINT(SCORE):   proc phreg data=;
> WARNING: Apparent symbolic reference LIST not resolved.
> MPRINT(SCORE):   model eventnscf1= &list run;
>
> ERROR 22-322: Syntax error, expecting one of the following: a
> name, ;, /, _CHARACTER_, _CHAR_,
>               _NUMERIC_.
>
> ERROR 200-322: The symbol is not recognized and will be ignored.
>
> NOTE: The SAS System stopped processing this step because of errors.
> NOTE: PROCEDURE PHREG used (Total process time):
>       real time           0.01 seconds
>       cpu time            0.01 seconds
>
> MLOGIC(SCORE):  %DO loop index variable I is now 25; loop will not
> iterate again.
> MLOGIC(SCORE):  Ending execution.

Thank you Tom for answering my question...It WORKED!!
Everyone here is Tom's answer:

Tom Abernathy to me
"You have a dataset that you want to use to generate multiple PROC
PHREG calls. You seem to be having a lot of trouble getting your macro
logic to work. Might be easier if you just do it without the macro
logic.

filename sascode temp;

data _null_;
set Best_SUBSETS;

file sascode;
put 'proc phreg data=mydata;'
/ ' model eventnscf1=' VariablesInModel ';'
/ 'run;'
;
run;
%inc sascode /source2 ;"
First  |  Prev  | 
Pages: 1 2
Prev: How to import a .xlsx file over 256 columns?
Next: HII