Code
proc logistic data = NEDS.neds_2016_pneumonia_recat;
class died_visit (ref = "0") pay1recat (ref = "3") hosp_controlrecat (ref = "4") hosp_urcat4recat (ref = "1") hosp_ur_teach (ref = "0") hosp_traumarecat (ref = "0") / param = ref;
model died_visit = pay1recat hosp_controlrecat hosp_urcat4recat hosp_ur_teach hosp_traumarecat / link = glogit;
slice pay1recat*hosp_controlrecat/sliceby(pay1recat='3') diff oddsratio cl;
slice pay1recat*hosp_controlrecat/sliceby(pay1recat='2') diff oddsratio cl;
slice pay1recat*hosp_controlrecat/sliceby(pay1recat='1') diff oddsratio cl;
slice pay1recat*hosp_controlrecat/sliceby(hosp_controlrecat='1') diff oddsratio cl;
slice pay1recat*hosp_controlrecat/sliceby(hosp_controlrecat='2') diff oddsratio cl;
slice pay1recat*hosp_controlrecat/sliceby(hosp_controlrecat='3') diff oddsratio cl;
slice pay1recat*hosp_controlrecat/sliceby(hosp_controlrecat='4') diff oddsratio cl;
slice pay1recat*hosp_urcat4recat/sliceby(pay1recat='3') diff oddsratio cl;
slice pay1recat*hosp_urcat4recat/sliceby(pay1recat='2') diff oddsratio cl;
slice pay1recat*hosp_urcat4recat/sliceby(pay1recat='1') diff oddsratio cl;
slice pay1recat*hosp_urcat4recat/sliceby(hosp_urcat4recat='1') diff oddsratio cl;
slice pay1recat*hosp_urcat4recat/sliceby(hosp_urcat4recat='2') diff oddsratio cl;
slice pay1recat*hosp_ur_teach/sliceby(pay1recat='3') diff oddsratio cl;
slice pay1recat*hosp_ur_teach/sliceby(pay1recat='2') diff oddsratio cl;
slice pay1recat*hosp_ur_teach/sliceby(pay1recat='1') diff oddsratio cl;
slice pay1recat*hosp_ur_teach/sliceby(hosp_ur_teach='0') diff oddsratio cl;
slice pay1recat*hosp_ur_teach/sliceby(hosp_ur_teach='1') diff oddsratio cl;
slice pay1recat*hosp_ur_teach/sliceby(hosp_ur_teach='2') diff oddsratio cl
slice pay1recat*hosp_traumarecat/sliceby(pay1recat='3') diff oddsratio cl;
slice pay1recat*hosp_traumarecat/sliceby(pay1recat='2') diff oddsratio cl;
slice pay1recat*hosp_traumarecat/sliceby(pay1recat='1') diff oddsratio cl;
slice pay1recat*hosp_traumarecat/sliceby(hosp_traumarecat='0') diff oddsratio cl;
slice pay1recat*hosp_traumarecat/sliceby(hosp_traumarecat='1') diff oddsratio cl;
slice pay1recat*hosp_traumarecat/sliceby(hosp_traumarecat='2') diff oddsratio cl;
slice pay1recat*hosp_traumarecat/sliceby(hosp_traumarecat='3') diff oddsratio cl;
run;
ERROR: Effects used in the SLICE statement must have appeared previously in the MODEL statement.
NOTE: The SAS System stopped processing this step because of errors.
Hello ksharp, thanks! I did assume that would be the case and ran the code again adding the interaction terms but got this error.
proc logistic data = NEDS.neds_2016_pneumonia_recat;
231 class died_visit (ref = "0") pay1recat (ref = "3") hosp_controlrecat (ref = "4")
231! hosp_urcat4recat (ref = "1") hosp_ur_teach (ref = "0") hosp_traumarecat (ref = "0") / param =
231! ref;
232 model died_visit = pay1recat hosp_controlrecat pay1recat*hosp_controlrecat hosp_urcat4recat
232! pay1recat*hosp_urcat4recat hosp_ur_teach pay1recat*hosp_ur_teach hosp_traumarecat
232! pay1recat*hosp_traumarecat / link = glogit;
233 slice pay1recat*hosp_controlrecat/sliceby(pay1recat='3') diff oddsratio cl;
234 slice pay1recat*hosp_controlrecat/sliceby(pay1recat='2') diff oddsratio cl;
235 slice pay1recat*hosp_controlrecat/sliceby(pay1recat='1') diff oddsratio cl;
236 slice pay1recat*hosp_controlrecat/sliceby(hosp_controlrecat='1') diff oddsratio cl;
237 slice pay1recat*hosp_controlrecat/sliceby(hosp_controlrecat='2') diff oddsratio cl;
238 slice pay1recat*hosp_controlrecat/sliceby(hosp_controlrecat='3') diff oddsratio cl;
239 slice pay1recat*hosp_controlrecat/sliceby(hosp_controlrecat='4') diff oddsratio cl;
240 slice pay1recat*hosp_urcat4recat/sliceby(pay1recat='3') diff oddsratio cl;
241 slice pay1recat*hosp_urcat4recat/sliceby(pay1recat='2') diff oddsratio cl;
242 slice pay1recat*hosp_urcat4recat/sliceby(pay1recat='1') diff oddsratio cl;
243 slice pay1recat*hosp_urcat4recat/sliceby(hosp_urcat4recat='1') diff oddsratio cl;
244 slice pay1recat*hosp_urcat4recat/sliceby(hosp_urcat4recat='2') diff oddsratio cl;
245 slice pay1recat*hosp_ur_teach/sliceby(pay1recat='3') diff oddsratio cl;
246 slice pay1recat*hosp_ur_teach/sliceby(pay1recat='2') diff oddsratio cl;
NOTE: PROCEDURE LOGISTIC used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
NOTE: The SAS System stopped processing this step because of errors.
247 slice pay1recat*hosp_ur_teach/sliceby(pay1recat='1') diff oddsratio cl;
248 slice pay1recat*hosp_ur_teach/sliceby(hosp_ur_teach='0') diff oddsratio cl;
249 slice pay1recat*hosp_ur_teach/sliceby(hosp_ur_teach='1') diff oddsratio cl;
250 slice pay1recat*hosp_ur_teach/sliceby(hosp_ur_teach='2') diff oddsratio cl
251 slice pay1recat*hosp_traumarecat/sliceby(pay1recat='3') diff oddsratio cl;
-----
22
76
ERROR 22-322: Syntax error, expecting one of the following: ;, ADJ, ADJDFE, ADJUST, ADJUSTMENT,
ALPHA, AT, BYLEVEL, CHISQ, CL, CORR, COV, DF, DIFF, DIFFS, E, EPSILON, EST, EXP,
ILINK, JOINT, LINES, LINESTABLE, MEANS, NOF, NOMEANS, OBSMARGINS, ODDSRATIO,
ODDSRATIOS, OR, PDIFF, PLOT, PLOTS, SEED, SIMPLE, SINGULAR, SLICEBY, STEPDOWN,
TDIFF.
ERROR 76-322: Syntax error, statement will be ignored.
252 slice pay1recat*hosp_traumarecat/sliceby(pay1recat='2') diff oddsratio cl;
253 slice pay1recat*hosp_traumarecat/sliceby(pay1recat='1') diff oddsratio cl;
254 slice pay1recat*hosp_traumarecat/sliceby(hosp_traumarecat='0') diff oddsratio cl;
255 slice pay1recat*hosp_traumarecat/sliceby(hosp_traumarecat='1') diff oddsratio cl;
256 slice pay1recat*hosp_traumarecat/sliceby(hosp_traumarecat='2') diff oddsratio cl;
257 slice pay1recat*hosp_traumarecat/sliceby(hosp_traumarecat='3') diff oddsratio cl;
258 run;
Hello @KKIND,
This syntax error is just due to the missing semicolon (added and highlighted in red below).
@KKIND wrote:
(...)
249 slice pay1recat*hosp_ur_teach/sliceby(hosp_ur_teach='1') diff oddsratio cl;
250 slice pay1recat*hosp_ur_teach/sliceby(hosp_ur_teach='2') diff oddsratio cl;
251 slice pay1recat*hosp_traumarecat/sliceby(pay1recat='3') diff oddsratio cl;
-----
22
76
ERROR 22-322: Syntax error, expecting one of the following: ;, ADJ, ADJDFE, ADJUST, ADJUSTMENT,(...)
Also, in the future please post logs in a code box (using the </> button). Then we can see what SAS has underlined to indicate an error. (It's not the line number 251 that is wrong ...)
You're welcome, but you should actually mark Ksharp's reply as the accepted solution, because his advice was most relevant with regard to your initial problem.
This can be corrected easily (also to help later readers of this thread with the same problem): Just select his post as the solution after clicking "Not the Solution" in the option menu (see icon below) of the current solution.
Did my instructions not work for you? This would be important to know as I post them regularly in situations like this.
@FreelanceReinh wrote:
You're welcome, but you should actually mark Ksharp's reply as the accepted solution, because his advice was most relevant with regard to your initial problem.
This can be corrected easily (also to help later readers of this thread with the same problem): Just select his post as the solution after clicking "Not the Solution" in the option menu (see icon below) of the current solution.
@KKIND wrote:
The instructions were not clear. Could you please resend it? Thanks!
Okay, let me try to split them into several steps:
Step 1: Open the option menu of the incorrectly selected solution by clicking the 3-horizontal-bars icon shown in the little screenshot above.
Step 2: Select "Not the Solution" from that menu. As a result, my post should no longer be highlighted in green. Also, Ksharp's post should then have a button "Accept as solution" or similar.
Step 3: Click that button at Ksharp's post to accept it as the solution.
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.