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 (July 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 15 Jul 2004 16:54:23 -0500
Reply-To:   "Dunn, Toby" <tdunn@TEA.STATE.TX.US>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Dunn, Toby" <tdunn@TEA.STATE.TX.US>
Subject:   Re: best subset logistic regression
Comments:   To: Dale McLerran <stringplayer_2@YAHOO.COM>
Content-Type:   text/plain; charset="us-ascii"

Dale you have one major problem and some clean up that's needs to be done:

%macro vica ; proc sql noprint ; select (nobs -delobs) into: num from dictionary.tables where libname="LSTGREY1" and memname="BEST_SUBSETS" ; quit ;

%do i=1 %to &num ;

data _null_ ; set lstgreyl.best_subsets ; if _N_ = &i ; call symput ('list', VariablesInModel) ; run ;

proc logistic data=lstgrey.lstgreyl ; model OUTCOME = &list ; run ;

%end ; %mend ; %vica ;

You don't need to create another &num variable use the one you create in the SQL. And when hitting the dictionary or sashelp meta data libnames and memnames are always stored in uppercase.

HTH Toby Dunn

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Dale McLerran Sent: Thursday, July 15, 2004 4:48 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: best subset logistic regression

Eva,

You might try replacing

proc sql noprint ; select (nobs -delobs) into: num from dictionary.tables where libname='lstgreyl' and memname="best_subsets" ; %let num = &num; quit ;

with

proc sql noprint ; select (nobs -delobs) into: num from dictionary.tables where upcase(libname)=upcase('lstgreyl') and upcase(memname)=upcase("best_subsets") ; quit ; %let num = &num;

I believe that the libname and memname values are stored as upper case, so you may not need to write upcase(libname) and upcase(memname). However, when comparing string values, it is always best, in my book, to make certain that you are comparing upper case values to upper case values. The way to ensure that is to upcase on both sides of a test for equality of two strings.

HTH,

Dale

--- Eva Ivits <Eva.Ivits@FELIS.UNI-FREIBURG.DE> wrote: > Dear All, > > best subset logistic regression with the options best=3 and > selection=score merly reports the best predictor variables being in > the > 3 best models but no model parameters, goodness of fit statistics, > etc. > When I want to check the models with the different subsets of > predictors > I will have to run them manually one by one. This problem is solved > by a > macro I've found on the Internet in the articel of Shtatland, > Kleinman > and Cain under: > http://www2.sas.com/proceedings/sugi28/258-28.pdf > > So I thought I would apply this macro to my best subset regression > output which I got with the "ods" option. But it does not run. Is > there > somebody who could maybe advise me what the problem is? > > Here is what I did: > > proc logistic data=lstgreyl.ranks ; > model b (event="1")=focdivmr ndvimr nirmr pcamr varmr > /best=3 > selection=score; > ods output BestSubsets=lstgreyl.best_subsets ; /*with this I got > the > table of the best models reporting only the variables*/ > run ; > > options mprint symbolgen mlogic ; > > %macro vica ; /*here starts the macro I've found on the Internet*/ > proc sql noprint ; > select (nobs -delobs) into: num > from dictionary.tables > where libname='lstgreyl' > and memname="best_subsets" ; > %let num = &num; > quit ; > > %do i=1 %to &num ; > > data _null_ ; > set lstgreyl.best_subsets ; > if _N_ = &i ; > call symput ('list', VariablesInModel) ; > run ; > > proc logistic data=lstgrey.lstgreyl ; > model OUTCOME = &list ; > run ; > > %end ; > %mend ; > %vica ; > > and then this error message comes: > > MLOGIC(VICA): Beginning execution. > MPRINT(VICA): proc sql noprint ; > MPRINT(VICA): select (nobs -delobs) into: num from > dictionary.tables > where libname='lstgreyl' > and memname="best_subsets" ; > NOTE: No rows were selected. > MLOGIC(VICA): %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(VICA): quit ; > NOTE: The SAS System stopped processing this step because of errors. > NOTE: PROCEDURE SQL used: > real time 0.01 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 VICA will stop executing. > MLOGIC(VICA): Ending execution. > --- > > Something is wrong with the num variable that no rows were selected. > As > I am no programmer guru I have no idea what the problem actually is. > I > would be so grateful if somebody could help. > > Warm regards, > Eva > > -- > Dr. Eva Ivits-Wasser > Abt. Fernerkundung und LIS > (Dep. of Remote Sensing and LIS) > Tennenbacherstr. 4. > D-79106 Freiburg > Deutschland > > tel: +49 761 2033699 > fax: +49 761 2033701 > > eva.ivits@felis.uni-freiburg.de >

===== --------------------------------------- Dale McLerran Fred Hutchinson Cancer Research Center mailto: dmclerra@fhcrc.org Ph: (206) 667-2926 Fax: (206) 667-5977 ---------------------------------------

__________________________________ Do you Yahoo!? Yahoo! Mail is new and improved - Check it out! http://promotions.yahoo.com/new_mail


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