Hi Friends,
I want to feed polychoric correlation to sem as it provides the goodness of fit test. I keep running into a syntax error. I found the code from an old post in the stata forum.
Here is my code after a little adaptation
local thevars BYS22*
polychoric `thevars'
mat polychR = r(R)
forvalues i=1/`: word count `thevars' ' {
forvalues j=1/`i' {
local setcor `setcor' `=polychR[`i',`j']'
}
if `i' < `: word count `thevars' ' local setcor `setcor' \
}
local N = r(N)
clear
ssd init `thevars'
ssd set obs `N'
ssd set cor `setcor'
sem(envdis2->BYS22*)///
,latent(endis2) nocapslatent stand
stata indicates "syntax error
Syntax is ssd init varnames
You must specify two or more new variables names" after the command ssd init `thevars'.
Can anyone tell me what goes wrong with my code and how to fix it?
I want to feed polychoric correlation to sem as it provides the goodness of fit test. I keep running into a syntax error. I found the code from an old post in the stata forum.
Here is my code after a little adaptation
local thevars BYS22*
polychoric `thevars'
mat polychR = r(R)
forvalues i=1/`: word count `thevars' ' {
forvalues j=1/`i' {
local setcor `setcor' `=polychR[`i',`j']'
}
if `i' < `: word count `thevars' ' local setcor `setcor' \
}
local N = r(N)
clear
ssd init `thevars'
ssd set obs `N'
ssd set cor `setcor'
sem(envdis2->BYS22*)///
,latent(endis2) nocapslatent stand
stata indicates "syntax error
Syntax is ssd init varnames
You must specify two or more new variables names" after the command ssd init `thevars'.
Can anyone tell me what goes wrong with my code and how to fix it?
Comment