Date: Thu, 15 Jul 2004 14:48:05 -0700
Reply-To: Dale McLerran <stringplayer_2@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Dale McLerran <stringplayer_2@YAHOO.COM>
Subject: Re: best subset logistic regression
In-Reply-To: <40F63FA2.C383393E@felis.uni-freiburg.de>
Content-Type: text/plain; charset=us-ascii
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 = #
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 = #
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 = #
> 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
|