BookmarkSubscribeRSS Feed
PSB
Fluorite | Level 6 PSB
Fluorite | Level 6

Hi all,

I'm running into an issue with my code. Briefly, I'm looking at how certain psychological constructs impact the effectiveness of a behavioral treatment. One of the treatments is time-out, where observers watch the kid for 30 seconds, and then record behavior for 10 seconds, and repeats this until the time-out ends. Naturally, it's an unbalanced dataset with some kids getting a few time-outs, and others getting many time-outs. I'm approaching it in a multi-level design:

Level 1 = the interval where data are collected (ranges from 1-197)

Level 2 = the unique ID # to identify the time-out (there are 545 unique time-outs)

Level 3 = the unique ID # to identify the child

So, interval data is nested in time-out, which is nested in child. 

I'm running this in a stepwise approach. My first two models converged (see end of message). But model 3, where I want to include the full nesting term provides the following error:

 
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
SYMBOLGEN: Macro variable _SASWSTEMP_ resolves to /home/u60849988/.sasstudio/.images/495a0ef2-2874-447e-a1c1-b64f1cce7501
SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.
SYMBOLGEN: Macro variable GRAPHINIT resolves to GOPTIONS RESET=ALL GSFNAME=_GSFNAME;
68
69 PROC GLIMMIX DATA=impstdmrpsra2 METHOD=LAPLACE;
70 CLASS MRPSID UnqTONum IntervalNum Meds TOTxCond;
71 MODEL Effective = meds TOTxCond week ptadhd ptcp pticu24 pticu24*TOTxCond / SOLUTION CL;
72 RANDOM intercept / SUBJECT=MRPSID;
73 RANDOM intercept / SUBJECT= UnqTONum(MRPSID);
74 RANDOM intercept / SUBJECT=IntervalNum(UnqTONum(MRPSID)) TYPE=UN;
_
22
200
ERROR 22-322: Syntax error, expecting one of the following: a name, ), *.
ERROR 200-322: The symbol is not recognized and will be ignored.
 
Importantly, this occurs whether I use a singular random statement (i.e., RANDOM intercept / SUBJECT = IntervalNum(UnqTONum(MRPSID)) or multiple random statements as shown below. This is happening across both continuous and categorical variables. Any feedback or thoughts would be greatly appreciated. Thanks all. 

 

Model 3 - not converging, receiving above error. 

PROC GLIMMIX DATA=impstdmrpsra2 METHOD=LAPLACE;
CLASS MRPSID UnqTONum IntervalNum Meds TOTxCond;
MODEL Effective = meds TOTxCond week ptadhd ptcp pticu24 pticu24*TOTxCond / SOLUTION CL;
RANDOM intercept / SUBJECT=MRPSID;
RANDOM intercept / SUBJECT= UnqTONum(MRPSID);
RANDOM intercept / SUBJECT=IntervalNum(UnqTONum(MRPSID)) TYPE=UN;
options mprint mlogic symbolgen ;
RUN;

 

Model 1 - converges.

PROC GLIMMIX DATA=impstdmrpsra2 METHOD=LAPLACE;
CLASS MRPSID Meds TOTxCond;
MODEL Effective = meds TOTxCond week ptadhd ptcp pticu24 pticu24*TOTxCond / SOLUTION CL;
RANDOM intercept / SUBJECT=MRPSID TYPE=UN;
RUN;

 

Model 2 - converges.

PROC GLIMMIX DATA=impstdmrpsra2 METHOD=LAPLACE;
CLASS MRPSID UnqTONum Meds TOTxCond;
MODEL Effective = meds TOTxCond week ptadhd ptcp pticu24 pticu24*TOTxCond / SOLUTION CL;
RANDOM intercept / SUBJECT=UnqTONum(MRPSID) TYPE=UN;
RUN;

 

 

6 REPLIES 6
ballardw
Super User

You should paste the LOG into a text box opened with the </> .

Reason is the location of the  _ in this bit is important because it will appear in the location that SAS reports the syntax error.

74 RANDOM intercept / SUBJECT=IntervalNum(UnqTONum(MRPSID)) TYPE=UN;
_
22
200
ERROR 22-322: Syntax error, expecting one of the following: a name, ), *.
ERROR 200-322: The symbol is not recognized and will be ignored.

Another reason to post the text into a text box is that the forum software reformats pasted text in the main window, such are removing the spaces that would align the _ in the error message. Sometimes there can be other not visible characters that creep into code files (copy paste from html or word processor documents for example) that the code parser finds by you don't see. Someone with the tools and interest can often find those in the text box.

 

Also please note that descriptions such as "So, interval data is nested in time-out, which is nested in child" really should reference variable names for clarity.

PSB
Fluorite | Level 6 PSB
Fluorite | Level 6
Thanks for the note - I'll be sure to make note of that in the future! Apologies for the mistake.
Ksharp
Super User
Your syntax is not right:
RANDOM intercept / SUBJECT=IntervalNum(UnqTONum(MRPSID)) TYPE=UN;
--->
RANDOM intercept / SUBJECT=IntervalNum(UnqTONum) TYPE=UN;

a.k.a you could only have one strata or parenthesis NOT two parenthesis.
PSB
Fluorite | Level 6 PSB
Fluorite | Level 6

Is that true? I feel like I've read on SAS documentation that you can have multiple levels of nesting, such as what I have in my model. But if that is the case, then how do models account for multiple levels? 

Level 1 = IntervalNum

Level2 = UnqTONum

Level3 = MRPSID

 

Ksharp
Super User
If you want to model multiple levels, you can put it at left side :

RANDOM intercept I ntervalNum/ SUBJECT=UnqTONum(MRPSID) TYPE=UN;
jiltao
SAS Super FREQ

SUBJECT=IntervalNum(UnqTONum(MRPSID))  should be changed to

SUBJECT=IntervalNum(UnqTONum MRPSID) 

Thanks,

Jill

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 6 replies
  • 986 views
  • 2 likes
  • 4 in conversation