BookmarkSubscribeRSS Feed
RobertNYC
Obsidian | Level 7

 

 

 

I’m using an offset variable in some model builds and I am trying to output the coefficients in order to score datasets for automated scoring.  When I go to score the data it seems like the offset value is not saving in the coefficients file. 

 

In the past, when I have used the WEIGHT option, I never had this problem. 

 

Is there I when to save the offset value without having to calculate the  “off”  variable everytime I score data?

 

proc logistic data= training outmodel= mod.MYMODEL descending;
model target=  
sales_ratiod
AGE_GT45
EM
RECENCY
PURCHASE_ORDERS
X_division
INDL_BT
WEEKEND_SHOPPER
/ offset=off   ; 
output predicted=p_response; run; quit;
 
 
 
proc logistic inmodel=MYMODEL   ;
score data= MYDATA  out=SCORED_DATA;
run;
 
ERROR: Variable off not found in DATA=MYMODEL  
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.SCORED_DATA may be incomplete.  When this step was stopped there were 0 observations and 0 variables.
WARNING: Data set WORK.SCORED_DATA was not replaced because this step was stopped.
NOTE: PROCEDURE LOGISTIC used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds

 

4 REPLIES 4
Reeza
Super User

OFFSET may be a fixed value for you, but in the program it's designed to accept a variable. So it's not being treated as a constant, which is why it needs to be specified in the scoring data as well. It could be different values dependent on input variables for example.

Ksharp
Super User

Could you try SCORE statement in PROC LOGISTIC.

 

proc logistic data= training outmodel= mod.MYMODEL descending;
model target=  
sales_ratiod
AGE_GT45
EM
RECENCY
PURCHASE_ORDERS
X_division
INDL_BT
WEEKEND_SHOPPER
/ offset=off   ; 

score data= MYDATA  out=SCORED_DATA;
run;
RobertNYC
Obsidian | Level 7

Thanks Ksharp, 

 

Unfortunately, the off var still did not  save in the coefficients file. 

 

 

23         proc logistic data=w.training_adj outmodel= mod.MYMODEL NAMELEN =32 descending;

24         model winback=

25         sales_ratiod

26         AGE_GT45

27         EM

28         RECENCY

29         PURCHASE_ORDERS

30         X_division

31         INDL_BT

32         WEEKEND_SHOPPER

33         DISTANCE_IND

34         PURCHASES_Q1

35         INDP_FOOTWEAR_B

36         INDP_SWEATERS_M

37         INDP_FOOTWEAR_M

38         DOLL_HOME

39         INDP_OUTERWEAR_B

40         West_ind

41         AUR

42         FTRANS

43         INDL_GOLF_TENNIS_W

44         FINDL_ELEVATED_W

45         INDP_DRESSES_SKIRTS_W

46         / stb lackfit hier=single  offset=off  /*ctable pprob=0.1 to .40 by .01*/ ;

47         output out=out predicted=p_response;

48         score data= VALIDATION_ADJ  out=SCORED_DATA; run;

 

ERROR: Variable off not found in DATA=WORK.VALIDATION_ADJ.

NOTE: The SAS System stopped processing this step because of errors.

NOTE: There were 1444748 observations read from the data set W.TRAINING_ADJ.

WARNING: The data set MOD.MYMODEL may be incomplete.  When this step was stopped there were 0 observations and 6 variables.

WARNING: Data set MOD.MYMODEL was not replaced because this step was stopped.

 

WARNING: Data set WORK.OUT was not replaced because this step was stopped.
WARNING: The data set WORK.SCORED_DATA may be incomplete. When this step was stopped there were 0 observations and 0 variables.
WARNING: Data set WORK.SCORED_DATA was not replaced because this step was stopped.

StatDave
SAS Super FREQ

The offset variable is essentially a predictor variable in the model.  Any data that you want to score has to have values of the model predictors, so the offset has to be available.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1892 views
  • 2 likes
  • 4 in conversation