1
votes

Has someone created manual code to score a dataset using results from proc glm in SAS?

Note: In this study there are two different programs, with 3 versions of two different programs. X01 X02 X03 Y01 Y02 Y03

proc glm data=maindata;
 class program_group;
 model program_score = prog_group TOBACCO DRUGS ALCOHOL age_on_admit 
                      yrs_in_program stand_test_score
                      / solution ss1 ss3;
      format program_group $program_group.
;
output out = results predicted=phat r=resid;
ods output parameterestimates = out.program_test_year1;
run;

Do I need to create dummy variables for the 6 different program groups when I run proc glm if I intend to read in the parameter estimates manually and score another dataset?

1
Why? There's PROC SCORE and several other ways...blogs.sas.com/content/iml/2014/02/19/…Reeza

1 Answers

2
votes

EDIT: Since you have SAS 9.2 then you should use PROC SCORE. Another trick is to include your data in the model data and leave the y/dependent value blank. If you get an output set of the scored data your additional data will also be scored. You can get this via OUTPUT out=want p=predicted;

There's PROC SCORE and several other ways. The CODE statement is new and underused - probably what you're looking for.

proc glm data=A noprint;
model y = x | x | x;  
code file='glmScore.sas';
quit;

data Pred;
set ScoreX;
%include 'glmScore.sas';
run;

See a list of ways itemized here: http://blogs.sas.com/content/iml/2014/02/19/scoring-a-regression-model-in-sas.html