Date: Tue, 26 Jan 1999 15:16:50 +0000 John Whittington "SAS(r) Discussion" John Whittington Re: programming question To: Peter Crawford cc: Maria Stepanova text/plain; charset="us-ascii"

At 13:15 26/01/99 +0000, Peter Crawford wrote:

>Isn't this what proc score is for

Peter, it is indeed - and all Maria needs to do to use it is to add a couple of variables (_TYPE_ and _NAME_ - they *must* have these names) to her 'coefficients' data set. In Maria's case, _TYPE_ will always be SCORE and _NAME_ will always be the name she wants for the variable representing the predicted value. So, in terms of the simple example she gave:

>So lib.estim has the following structure, > var1 var2 var3 var4 > 0.1 0.2 0.3 0.4 >where varI is the name of the predictor variable and 0.1 etc is the >corresponding regression coefficient estimate >And lib.data : >>var1 var2 var3 var4 >1 3 4 5 >2 3 6 7 >8 9 10 11 >where varI is again the predictor name and the variable values are the >predictor values. >The simplest and extremely time consuming way is to calculate predicted >value by typing in the coefficients in the equation by hand. >The simplest and extremely time consuming way is to calculate predicted >value by typing in the coefficients in the equation by hand. >data lib.data; >pred=0.1*var1+0.2*var2+0.3*var3+0.4*var4; >run; >The problem is that I will have to do it dozens of times and I have over >40 predictors.

data lib.estim ; set lib.estim ; _TYPE_ = 'SCORE' ; _NAME_ = 'pred' ; run ; proc score data = lib.data score = lib.estim out = whatever ; var var1 - var4 ; run ;

If only the predicted value is wanted in the output dataset ('whatever'), then one can obviously add a dataset option (keep = whatever) after its name.

Regards,

John

---------------------------------------------------------------- Dr John Whittington, Voice: +44 (0) 1296 730225 Mediscience Services Fax: +44 (0) 1296 738893 Twyford Manor, Twyford, E-mail: medisci@powernet.com Buckingham MK18 4EL, UK mediscience@compuserve.com ----------------------------------------------------------------

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