Hi
I am running the following code on a dataset; however, I am getting this error message: ERROR 180-322: Statement is not valid or is used out of proper order. I would appreciate inputs from the SAS community to help resolve this. Thank you.
For context, I was trying to determine the impact of an intervention (variable group: 1 = control, 2 = intervention) on the outcome variable (infection: 1 = Yes, 0 = No). The trial was conducted across 8 clusters (villages), and information on the same individuals in each village was collected at two time points: baseline and follow-up (time=0 baseline, 1 follow-up). FullID pertains to individual ID.
proc glimmix data=trial;
class village group;
model infection (ref='0')/n=group /s dist=binomila link=logit;
random intercept time/subject= village fullid type=vc;
lsmeans group/cl ilink;
ods select lsmeans;
run;
Best practice on this forum when discussing error messages is to copy from the LOG the text of the code submitted and all the notes, messages, warnings and/or errors. Then on the forum open a text box using the
</> icon that appears above the message window and paste all of the copied text.
The text box will maintain formatting and many of these error messages will provide diagnostic information such as column and statement that SAS determines the error appears which gives us more clues as to likely solutions.
Generically this error could come from a statement a procedure doesn't use or something such as a missing semicolon. Another possibility incompatible options.
With that, did the this line show the error?
model infection (ref='0')/n=group /s dist=binomila link=logit;
Most of the statements that use a / to indicate the start of options only allow a single slash. So if that line threw the error try deleting the / before the S before Dist=. Might want to use Dist=Binomial as well.
If your Y variable is 0 1 ,the right syntax is
model infection(ref='0')=group /s dist=binary link=logit;
If your Y is a count number of infection=0 ,the right syntax is
model count/n=group /s dist=binomial link=logit;
Thank you. I've tried using the suggested codes for categorical data, corrected the spelling, and ensured the inclusion of a semicolon, but I'm still receiving the following error. I've pasted the error message from the SAS log here.
808 proc
808! glimmix data=trial;
-------
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
809 class village group;
-----
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
810 model infection (ref='0')/n= group /s dist=binary link=logit;
-----
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
811 random intercept time/subject=village fullid type=vc;
------
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
812 run;
You did not follow my code.
As I said, if your Y variable is 0 or 1, you should this:
model infection (ref='0')= group /s dist=binary link=logit;
not this
model infection (ref='0')/n= group /s dist=binary link=logit;
And here is an example.
1 proc glimmix data=sashelp.heart(obs=1000);
2 class bp_status;
3 model status(ref='Dead')=bp_status /s dist=binary link=logit;
4 lsmeans bp_status/cl ilink;
5 ods select lsmeans;
6 run;
NOTE: GLIMMIX 过程正在对概率 Status=“Alive”建模。
NOTE: Convergence criterion (GCONV=1E-8) satisfied.
NOTE: “PROCEDURE GLIMMIX”所用时间(总处理时间):
实际时间 2.49 秒
CPU 时间 0.45 秒
Based on your log, check to see whether there is a syntax error or missing semicolon on the LINE BEFORE the PROC GLIMMIX statement. If you can't find it, paste the log starting from a few lines BEFORE what you've shown us.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.