/*Model 1*/
Proc logistic data= dormant_pca_cc;
class BU_419_DQ E1_B_07;
model FCS_bad_9m_Jun19 =
BU_419_DQ
BU_26_AB_NUM
BU_345_HN_NUM
RR_CHR_105
BU_162_GG_NUM
RR_CHR_169
BU_799_TEB_NUM
RR_CHR_111
BU_301_PL_NUM
BU_1552_SHC_NUM
BU_1577_RIC_NUM
RR_CHR_122
E1_B_07
bu_670_uz_num;
ods output GlobalTests = Globaltests_full;
run;
data _null_;
set globaltests_full;
if test = "Likelihood Ratio" then do;
call symput ("ChiSq_full", ChiSq);
call symput ("DF_full", DF);
END;
RUN;
/*Model 2*/
Proc logistic data= dormant_pca_cc2;
class BU_419_DQ E1_B_07;
model FCS_bad_9m_Jun19 =
BU_419_DQ
BU_26_AB_NUM
BU_345_HN_NUM
RR_CHR_105
BU_162_GG_NUM
RR_CHR_169
BU_799_TEB_NUM
RR_CHR_111
BU_301_PL_NUM
BU_1552_SHC_NUM
BU_1577_RIC_NUM
RR_CHR_122
E1_B_07;
ods output GlobalTests = Globaltests_reduced;
run;
data _null_;
set globaltests_reduced;
if test = "Likelihood Ratio" then do;
call symput ("ChiSq_reduced", ChiSq);
call symput ("DF_reduced", DF);
END;
RUN;
data = LRT_result;
LR =(&ChiSq_full - &ChiSq_reduced);
DF = (&DF_full - &DF_reduced);
p=1 - probchi(chiSq,DF);
RUN;
This is a code to check the change in likelihood ratio. I am getting the below error:
1 The SAS System 10:46 Sunday, April 28, 2024
1 ;*';*";*/;quit;run;
2 OPTIONS PAGENO=MIN;
3 %LET _CLIENTTASKLABEL='Test2';
4 %LET _CLIENTPROCESSFLOWNAME='Model Macro';
5 %LET _CLIENTPROJECTPATH='C:\Users\8522019\OneDrive - Lloyds Banking Group\Desktop\Likelihood test1.egp';
6 %LET _CLIENTPROJECTPATHHOST='MMD014713504257';
7 %LET _CLIENTPROJECTNAME='Likelihood test1.egp';
8 %LET _SASPROGRAMFILE='';
9 %LET _SASPROGRAMFILEHOST='';
10
11 ODS _ALL_ CLOSE;
12 OPTIONS DEV=SVG;
13 GOPTIONS XPIXELS=0 YPIXELS=0;
14 %macro HTML5AccessibleGraphSupported;
15 %if %_SAS_VERCOMP_FV(9,4,4, 0,0,0) >= 0 %then ACCESSIBLE_GRAPH;
16 %mend;
17 FILENAME EGHTML TEMP;
18 ODS HTML5(ID=EGHTML) FILE=EGHTML
19 OPTIONS(BITMAP_MODE='INLINE')
20 %HTML5AccessibleGraphSupported
21 ENCODING='utf-8'
22 STYLE=HtmlBlue
23 NOGTITLE
24 NOGFOOTNOTE
25 GPATH=&sasworklocation
26 ;
NOTE: Writing HTML5(EGHTML) Body file: EGHTML
27
28 data = LRT_result;
____
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
29 LR =(&ChiSq_full - &ChiSq_reduced);
__
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
30 DF = (&DF_full - &DF_reduced);
__
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
31 p=1 - probchi(chiSq,DF);
_
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
32 RUN;
33
34 %LET _CLIENTTASKLABEL=;
35 %LET _CLIENTPROCESSFLOWNAME=;
36 %LET _CLIENTPROJECTPATH=;
37 %LET _CLIENTPROJECTPATHHOST=;
38 %LET _CLIENTPROJECTNAME=;
39 %LET _SASPROGRAMFILE=;
40 %LET _SASPROGRAMFILEHOST=;
41
42 ;*';*";*/;quit;run;
43 ODS _ALL_ CLOSE;
44
45
46 QUIT; RUN;
47
Can anyone help me correcting the code? That would be great!
data = LRT_result;
There is no equal sign in a simple DATA statement.
Thanks. I have changed the code and ran it. No error now. I wish you have a lovely Sunday ahead 🙂
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.