

Using define with widetolong 

Message/Author 


Hi, I have a file in wide format (twins data) and i want to analysis in long format. I use: data widetolong: wide = x1 x2  y1 y2  z1 z2; long = x  y  z; idvariable = fam; repetition = pid; variable: names = x1 x2 y1 y2 z1 z2 fam; usevariable = x y z; I want to compute the interaction k=x*z. I try define: k1=x1*z1; k2=x2*z2; And i recive the error message that k1 and k2 don't exist. I add k1 and k2 in the wide statement and k in the wide statement. I recive the same error message. I add k1, k2 and k in the usevariable statement. The model was estimated but it also compute means and variance for k1 and k2. I realy confuse... the analysis was in the long format but k1 and k2 was in wide format. I probably doing something wrong How can i compute the interaction ? Thanks Alain Girard 


Try the following: data widetolong: wide = x1 x2  y1 y2  z1 z2  k1 k2; long = x  y  z  k; idvariable = fam; repetition = pid; variable: names = x1 x2 y1 y2 z1 z2 fam; usevariable = k1 k2 x y z k; Auxiliary = k1 k2; define: k1=x1*z1; k2=x2*z2; 

Back to top 

