Programming the statistical procedures from SAS

How to translate the output fr proc logistic used to score data proc logistic inmodel=model_equation

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 96
Accepted Solution

How to translate the output fr proc logistic used to score data proc logistic inmodel=model_equation

 

Hi, 

 

I have built a model using proc logistic below, and I have also used the output (equation) to score new data. At the moment we were scoring in SAS but going forward to equation will have to be translated into SQL code. Could you please let me know how to interprete the euqtion below?

 

Thank you very much

 

 

/*Model Buid*/

 

proc logistic data=TRAINING outmodel=MODEL_EQUATION descending plots(only)=roc;
  class age_band extended_play_band Device_DD_12w_band no_visits_12w_band time_spend_onsite_12w_band ;
  model sub_target(event='1') = age_band extended_play_band Device_DD_12w_band no_visits_12w_band      time_spend_onsite_12w_band / link=glogit;
score data=TRAINING out=Train_Scores;
run;

 

/*Score*/

proc logistic inmodel=MODEL_EQUATION;
  score data=CURRENT_BASE
  out=CURRENT_BASE_SCORES;
run;

 

_TYPE_ _NAME_ _CATEGORY_ _NAMEIDX_ _CATIDX_ _MISC_
L     . . 10
M NYYNYNNN   . . 23
G age_band 1.<=25 0 0 2
G age_band 2.25 To 30 0 1 2
G age_band 3.30 To 35 0 2 2
G age_band 4.35 To 40 0 3 2
G age_band 5.40 To 45 0 4 2
G age_band 6.45 To 50 0 5 2
G age_band 7.50 To 55 0 6 2
G age_band 8.55 To 60 0 7 2
G age_band 9.60+ 0 8 -2
G age_band   -1 -1 0
G age_band   -1 -2 -30
G extended_play_band 1.0 days 1 0 2
G extended_play_band 2.1 day 1 1 2
G extended_play_band 3.2 days 1 2 2
G extended_play_band 4.2 To 4 days 1 3 2
G extended_play_band 5.More than 4 days 1 4 -2
G extended_play_band   -2 -1 0
G extended_play_band   -2 -2 -30
G Device_DD_12w_band 1.Yes 2 0 2
G Device_DD_12w_band 2.No 2 1 -2
G Device_DD_12w_band   -3 -1 0
G Device_DD_12w_band   -3 -2 -30
G no_visits_12w_band 1.None 3 0 2
G no_visits_12w_band 2.1  visit 3 1 2
G no_visits_12w_band 3.2 To 3  visits 3 2 2
G no_visits_12w_band 4.4 To 6 visits 3 3 2
G no_visits_12w_band 5.7 or more visits 3 4 -2
G no_visits_12w_band   -4 -1 0
G no_visits_12w_band   -4 -2 -30
G time_spend_onsite_12w_band 1.2min 4 0 2
G time_spend_onsite_12w_band 2.5 min 4 1 2
G time_spend_onsite_12w_band 3.15 min 4 2 2
G time_spend_onsite_12w_band 4.40 min 4 3 2
G time_spend_onsite_12w_band 5.1h 30 min 4 4 2
G time_spend_onsite_12w_band 6.More than 1 h 30 4 5 -2
G time_spend_onsite_12w_band   -5 -1 0
G time_spend_onsite_12w_band   -5 -2 -30
G sub_target 1 5 0 11
G sub_target 0 5 1 -11
G sub_target   -6 0 962
G sub_target   -6 1 8657
G sub_target   -6 -2 -12
E Intercept E 0 0 -1.989606292
E EFFECT G 0 0 0
E EFFECT X 0 0 0
E EFFECT E 0 0 0.609907938
E EFFECT E 0 1 0.608616265
E EFFECT E 0 2 0.324517086
E EFFECT E 0 3 0.208340512
E EFFECT E 0 4 -0.133391473
E EFFECT E 0 5 -0.254415291
E EFFECT E 0 6 -0.348959221
E EFFECT E 0 7 -0.328500202
E EFFECT G 1 0 1
E EFFECT X 1 0 1
E EFFECT E 1 0 -0.373354935
E EFFECT E 1 1 -0.522159127
E EFFECT E 1 2 -0.266655139
E EFFECT E 1 3 0.248943742
E EFFECT G 2 0 2
E EFFECT X 2 0 2
E EFFECT E 2 0 0.187089275
E EFFECT G 3 0 3
E EFFECT X 3 0 3
E EFFECT E 3 0 -0.049154591
E EFFECT E 3 1 0.345175518
E EFFECT E 3 2 0.232629562
E EFFECT E 3 3 -0.129418109
E EFFECT G 4 0 4
E EFFECT X 4 0 4
E EFFECT E 4 0 -0.17159942
E EFFECT E 4 1 0.196868737
E EFFECT E 4 2 0.148384306
E EFFECT E 4 3 0.075433201
E EFFECT E 4 4 0.034985814
E EFFECT V . 0 0.004451947
E EFFECT V . 1 0.000568076
E EFFECT V . 2 0.014954355
E EFFECT V . 3 -0.000129658
E EFFECT V . 4 -0.001528856
E EFFECT V . 5 0.010736189
E EFFECT V . 6 -0.000270416
E EFFECT V . 7 -0.001456796
E EFFECT V . 8 -0.000882231
E EFFECT V . 9 0.008960256
E EFFECT V . 10 -0.000519628
E EFFECT V . 11 -0.001473351
E EFFECT V . 12 -0.000859936
E EFFECT V . 13 -0.000678084
E EFFECT V . 14 0.008033365
E EFFECT V . 15 -0.000319231
E EFFECT V . 16 -0.001759276
E EFFECT V . 17 -0.001155112
E EFFECT V . 18 -0.000910213
E EFFECT V . 19 -0.000763817
E EFFECT V . 20 0.009088793
E EFFECT V . 21 -0.000267753
E EFFECT V . 22 -0.001775369
E EFFECT V . 23 -0.001169047
E EFFECT V . 24 -0.00090607
E EFFECT V . 25 -0.000731201
E EFFECT V . 26 -0.000837189
E EFFECT V . 27 0.008640499
E EFFECT V . 28 0.000147963
E EFFECT V . 29 -0.002094687
E EFFECT V . 30 -0.001486877
E EFFECT V . 31 -0.001197141
E EFFECT V . 32 -0.001012982
E EFFECT V . 33 -0.001098766
E EFFECT V . 34 -0.000978575
E EFFECT V . 35 0.010499309
E EFFECT V . 36 0.000545479
E EFFECT V . 37 -0.002564363
E EFFECT V . 38 -0.001954651
E EFFECT V . 39 -0.001602579
E EFFECT V . 40 -0.001399642
E EFFECT V . 41 -0.001435222
E EFFECT V . 42 -0.001287284
E EFFECT V . 43 -0.001486063
E EFFECT V . 44 0.013066396
E EFFECT V . 45 0.001392132
E EFFECT V . 46 -0.000662184
E EFFECT V . 47 -0.000729924
E EFFECT V . 48 -0.000500487
E EFFECT V . 49 -0.000074663
E EFFECT V . 50 0.00018812
E EFFECT V . 51 0.000346121
E EFFECT V . 52 0.000479063
E EFFECT V . 53 0.000489094
E EFFECT V . 54 0.009480596
E EFFECT V . 55 5.76884E-05
E EFFECT V . 56 -0.000325705
E EFFECT V . 57 -0.000375672
E EFFECT V . 58 -0.000237197
E EFFECT V . 59 -0.000216465
E EFFECT V . 60 2.32136E-05
E EFFECT V . 61 0.000138117
E EFFECT V . 62 0.000272522
E EFFECT V . 63 0.000277609
E EFFECT V . 64 -0.001641732
E EFFECT V . 65 0.004604625
E EFFECT V . 66 0.000890715
E EFFECT V . 67 -0.000303457
E EFFECT V . 68 -8.44E-06
E EFFECT V . 69 0.000127129
E EFFECT V . 70 -0.000023587
E EFFECT V . 71 -0.000134442
E EFFECT V . 72 -0.000134375
E EFFECT V . 73 -0.000089133
E EFFECT V . 74 0.000254368
E EFFECT V . 75 -0.002856435
E EFFECT V . 76 -0.00129968
E EFFECT V . 77 0.00779224
E EFFECT V . 78 -0.001286215
E EFFECT V . 79 0.000536738
E EFFECT V . 80 0.000307785
E EFFECT V . 81 0.000138815
E EFFECT V . 82 6.88791E-05
E EFFECT V . 83 -0.000127788
E EFFECT V . 84 -0.000030966
E EFFECT V . 85 -0.000289437
E EFFECT V . 86 -0.000324579
E EFFECT V . 87 -0.003135854
E EFFECT V . 88 -0.001356534
E EFFECT V . 89 -0.002295489
E EFFECT V . 90 0.007292882
E EFFECT V . 91 0.002595577
E EFFECT V . 92 0.000253242
E EFFECT V . 93 0.000134431
E EFFECT V . 94 3.17489E-05
E EFFECT V . 95 -0.000127727
E EFFECT V . 96 -0.000196204
E EFFECT V . 97 -0.000128691
E EFFECT V . 98 7.41017E-05
E EFFECT V . 99 -0.000061406
E EFFECT V . 100 0.000907522
E EFFECT V . 101 0.000727013
E EFFECT V . 102 0.000436183
E EFFECT V . 103 -0.001800096
E EFFECT V . 104 0.003386082
E EFFECT V . 105 -0.001097715
E EFFECT V . 106 -0.000385195
E EFFECT V . 107 -0.000182626
E EFFECT V . 108 -0.000278222
E EFFECT V . 109 -0.000076404
E EFFECT V . 110 4.56044E-05
E EFFECT V . 111 0.000135544
E EFFECT V . 112 0.000255716
E EFFECT V . 113 0.000127127
E EFFECT V . 114 -0.000052143
E EFFECT V . 115 -0.000097682
E EFFECT V . 116 -0.000047106
E EFFECT V . 117 0.000107029
E EFFECT V . 118 -0.000109514
E EFFECT V . 119 0.004405613
E EFFECT V . 120 -0.00026463
E EFFECT V . 121 -0.000398048
E EFFECT V . 122 -0.000318491
E EFFECT V . 123 -0.000049796
E EFFECT V . 124 9.71719E-05
E EFFECT V . 125 -0.000022216
E EFFECT V . 126 2.31968E-05
E EFFECT V . 127 0.000187958
E EFFECT V . 128 0.000240991
E EFFECT V . 129 -0.000510874
E EFFECT V . 130 4.28724E-05
E EFFECT V . 131 -5.21E-06
E EFFECT V . 132 0.000209985
E EFFECT V . 133 -0.000272214
E EFFECT V . 134 -0.00089094
E EFFECT V . 135 0.006585419
E EFFECT V . 136 -0.000032897
E EFFECT V . 137 -0.000096658
E EFFECT V . 138 -0.000051461
E EFFECT V . 139 -0.000076673
E EFFECT V . 140 2.42103E-05
E EFFECT V . 141 -8.60E-06
E EFFECT V . 142 -0.000090536
E EFFECT V . 143 -0.000050168
E EFFECT V . 144 0.000277658
E EFFECT V . 145 -0.000155073
E EFFECT V . 146 -0.000048636
E EFFECT V . 147 8.75763E-05
E EFFECT V . 148 0.000189359
E EFFECT V . 149 -0.000141328
E EFFECT V . 150 -0.000791904
E EFFECT V . 151 -0.001177084
E EFFECT V . 152 0.005011082
E EFFECT V . 153 0.000963221
E EFFECT V . 154 0.00025336
E EFFECT V . 155 7.19285E-05
E EFFECT V . 156 0.000019043
E EFFECT V . 157 -0.00016052
E EFFECT V . 158 -0.000064137
E EFFECT V . 159 0.000094084
E EFFECT V . 160 -0.00020199
E EFFECT V . 161 4.11728E-05
E EFFECT V . 162 0.000130558
E EFFECT V . 163 0.000152036
E EFFECT V . 164 0.000201972
E EFFECT V . 165 8.84796E-05
E EFFECT V . 166 0.000148416
E EFFECT V . 167 -0.001500705
E EFFECT V . 168 -0.002239131
E EFFECT V . 169 -0.001498889
E EFFECT V . 170 0.006723426
E EFFECT V . 171 0.00363831
E EFFECT V . 172 -0.000688501
E EFFECT V . 173 -0.000074329
E EFFECT V . 174 -0.00015348
E EFFECT V . 175 -0.000145269
E EFFECT V . 176 3.08E-06
E EFFECT V . 177 0.000184652
E EFFECT V . 178 0.000348334
E EFFECT V . 179 0.000464245
E EFFECT V . 180 -0.000409315
E EFFECT V . 181 0.000196919
E EFFECT V . 182 7.68497E-05
E EFFECT V . 183 2.52648E-05
E EFFECT V . 184 0.00017209
E EFFECT V . 185 -0.002815374
E EFFECT V . 186 0.000336714
E EFFECT V . 187 0.000762319
E EFFECT V . 188 0.000751589
E EFFECT V . 189 0.02308276
E EFFECT V . 190 0.000602567
E EFFECT V . 191 0.000264291
E EFFECT V . 192 -0.00053944
E EFFECT V . 193 5.11117E-05
E EFFECT V . 194 -0.000327257
E EFFECT V . 195 7.38967E-05
E EFFECT V . 196 -0.000093565
E EFFECT V . 197 4.44893E-05
E EFFECT V . 198 0.000232133
E EFFECT V . 199 -0.001135944
E EFFECT V . 200 0.00058486
E EFFECT V . 201 0.000153368
E EFFECT V . 202 0.000340918
E EFFECT V . 203 -0.00019499
E EFFECT V . 204 -0.000265338
E EFFECT V . 205 -0.001929143
E EFFECT V . 206 -0.00005421
E EFFECT V . 207 0.000959489
E EFFECT V . 208 -0.005125481
E EFFECT V . 209 0.013170579
E EFFECT V . 210 -0.001001999
E EFFECT V . 211 0.000112427
E EFFECT V . 212 5.12976E-05
E EFFECT V . 213 1.85E-06
E EFFECT V . 214 -0.000141305
E EFFECT V . 215 0.000028918
E EFFECT V . 216 -0.000040637
E EFFECT V . 217 -0.000151469
E EFFECT V . 218 -0.000035142
E EFFECT V . 219 1.38339E-05
E EFFECT V . 220 7.81228E-05
E EFFECT V . 221 3.09595E-05
E EFFECT V . 222 9.64817E-05
E EFFECT V . 223 -0.000092614
E EFFECT V . 224 0.000508186
E EFFECT V . 225 -0.000856441
E EFFECT V . 226 -0.000937477
E EFFECT V . 227 8.40506E-05
E EFFECT V . 228 -0.004233821
E EFFECT V . 229 -0.001280689
E EFFECT V . 230 0.006383157
E EFFECT V . 231 -0.001298108
E EFFECT V . 232 0.00027481
E EFFECT V . 233 0.000246307
E EFFECT V . 234 6.06E-06
E EFFECT V . 235 3.81694E-05
E EFFECT V . 236 -0.000181544
E EFFECT V . 237 -0.000046325
E EFFECT V . 238 -0.000017635
E EFFECT V . 239 -0.000192028
E EFFECT V . 240 0.000347613
E EFFECT V . 241 1.56007E-05
E EFFECT V . 242 7.11752E-05
E EFFECT V . 243 -0.000166833
E EFFECT V . 244 2.62068E-05
E EFFECT V . 245 0.000704728
E EFFECT V . 246 0.00037034
E EFFECT V . 247 -0.00048812
E EFFECT V . 248 -0.000833255
E EFFECT V . 249 -0.004167523
E EFFECT V . 250 -0.00162104
E EFFECT V . 251 0.000330732
E EFFECT V . 252 0.005076467
E EFFECT V . 253 -0.001143516
E EFFECT V . 254 -8.71E-06
E EFFECT V . 255 0.000102476
E EFFECT V . 256 3.31019E-05
E EFFECT V . 257 0.000246055
E EFFECT V . 258 1.11997E-05
E EFFECT V . 259 -0.000048674
E EFFECT V . 260 3.83547E-05
E EFFECT V . 261 -0.000198024
E EFFECT V . 262 0.000597985
E EFFECT V . 263 -0.000174258
E EFFECT V . 264 -0.000101014
E EFFECT V . 265 -0.000334283
E EFFECT V . 266 0.000149422
E EFFECT V . 267 0.000910072
E EFFECT V . 268 0.000929281
E EFFECT V . 269 0.000119781
E EFFECT V . 270 -0.000767318
E EFFECT V . 271 -0.004485862
E EFFECT V . 272 -0.002198412
E EFFECT V . 273 -0.000202533
E EFFECT V . 274 0.000517959
E EFFECT V . 275 0.005976145
X 354   164 38091 9918.133105

Accepted Solutions
Solution
Monday
Grand Advisor
Posts: 16,893

Re: How to translate the output fr proc logistic used to score data proc logistic inmodel=model_equa

1. Use the CODE statement within PROC LOGISTIC to get the data step scoring code. These are basic calculations so you should be able to convert your datastep to a SQL step relatively easily. 

 

Here's an example of a full 'manual' process:

 

https://communities.sas.com/t5/SAS-Statistical-Procedures/How-to-determine-logistic-regression-formu...

 

View solution in original post


All Replies
Solution
Monday
Grand Advisor
Posts: 16,893

Re: How to translate the output fr proc logistic used to score data proc logistic inmodel=model_equa

1. Use the CODE statement within PROC LOGISTIC to get the data step scoring code. These are basic calculations so you should be able to convert your datastep to a SQL step relatively easily. 

 

Here's an example of a full 'manual' process:

 

https://communities.sas.com/t5/SAS-Statistical-Procedures/How-to-determine-logistic-regression-formu...

 

Highlighted
Frequent Contributor
Posts: 96

Re: How to translate the output fr proc logistic used to score data proc logistic inmodel=model_equa

Thank You very much Reeza.. It works perfectly :-)  I get exactly same scores as when I score automatically...

 

Alice

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 52 views
  • 0 likes
  • 2 in conversation