SAS code


I am trying to replicate this SAS code in STATA. I understand most of the commands, but I would like to know what org(upc) means. Is it like an indicator variable? Also, is the command assigning random effects for each listed variable: upc org(upc) store org

Thanks in advance!!

proc mixed data= out.sample_av2 method= ml;
by city prod_name;
class org store upc timevar city subject month;
model logprice_fill= subject/ ddfm=bw solution;
random intercept upc org(upc) store org/ subject = timevar;
ods output CovParms = out99.varcomp_pav_wst;


Less is more. Stay pure. Stay poor.
Not my area, but I believe it is. You may compare it to the common example, random effects for classrooms and schools as well as the combination of the two, plus couple of others things. Though, this is just my assumption.


Cookie Scientist
The A(B) syntax in SAS indicates "A nested within B." It's basically equivalent to adding intercepts for the A*B interaction. Which, if A is "explicitly nested" in B (the levels of A within each B are uniquely labeled), is equivalent to just random intercepts for A. If A is "implicitly nested" in B (the labels for A within each B repeat, despite in fact being different levels), then A(B) is the correct syntax rather than just A. See the section "Nested Effects" here:


Cookie Scientist
It says that all of the effects between the word "random" and the "/" character are varying across the levels of the "timevar" variable, whatever that is.


Less is more. Stay pure. Stay poor.
Also, it requests estimates for each of the listed random effects within each level/group of timevar.
Thank you Jake and hlsmith. Although, your last comments aren't clear enough to me. Do you think its definining those random effects as interactions between each variable and timevar?

My intention is to implement this code in STATA...
Last edited: