Date: Sat, 22 Jan 2005 11:50:15 -0500
Reply-To: Raynald Levesque <rlevesque@videotron.ca>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Raynald Levesque <rlevesque@videotron.ca>
Subject: Re: macro needed
In-Reply-To: <6.1.2.0.0.20050119150551.01a422d0@pop.socsci.ru.nl>
Content-type: text/plain; charset=US-ASCII
Hi
This is one way:
*//////////////////.
DEFINE !doit(nb=!TOKENS(1) )
!DO !run = 1 !TO !nb
INPUT PROGRAM .
comp school =-1.
comp b0j=-1.
leave school b0j.
loop #j= 1 to 15.
comp school=#j.
comp b0j = rv.normal(8,3).
loop #i = 1 to 20.
comp student = #i.
comp x = rv.normal(20,4).
comp e0ij = rv.normal(0,2).
comp y = b0j + 2*x + e0ij.
end case.
end loop.
end loop.
end file.
END INPUT PROGRAM.
MIXED y by school with x
/fixed x
/random intercept | subject(school) covtype(un)
/print solution g testcov
/method ml
/cri mxiter(200).
!DOEND
GET FILE='c:\temp\results.sav' .
!ENDDEFINE.
*////////////////////.
NEW FILE.
OMS
/select tables
/if commands = [ 'Mixed']
labels = ['Estimates of Covariance Parameters']
/DESTINATION FORMAT=sav NUMBERED="runID" OUTFILE = 'c:\temp\results.sav'
.
!doit nb=10.
OMSEND.
HTH
Raynald Levesque Raynald@spsstools.net
Visit my SPSS site: http://www.spsstools.net
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of
Pieter van Groenestijn
Sent: January 19, 2005 9:19 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: macro needed
Dear list,
In the syntax below I first generate some data. After this the output of
the 'Estimates of Covariance Parameters' table is saved.
So far so good.
What I want SPSS to do is run the syntax several times (for example 100)
and write down the results of the mentioned table in a sav file.
I think using a macro would help. My question is how should this macro look
like?
My syntax is:
OMS
/select tables
/if commands = [ 'Mixed']
labels = ['Estimates of Covariance Parameters']
/DESTINATION FORMAT=sav
outfile = 'c:\temp\results.sav'.
input program
comp school =-1.
comp b0j=-1.
leave school b0j.
loop #j= 1 to 15.
comp school=#j.
comp b0j = rv.normal(8,3).
loop #i = 1 to 20.
comp student = #i.
comp x = rv.normal(20,4).
comp e0ij = rv.normal(0,2).
comp y = b0j + 2*x + e0ij.
end case.
end loop.
end loop.
end file.
end inp pro.
exe.
mixed y by school with x
/fixed x
/random intercept | subject(school) covtype(un)
/print solution g testcov
/method ml
/cri mxiter(200).
OMSEND.
Any help will be very welcome!
Pieter van Groenestijn