For one of my research projects, I need to develop a macro for a loop of random samplings and RM ANOVAs. I have never dealt with SPSS syntax, so I would really appreciate if anyone can help me develop an appropriate macro. Thanks to you all!
Using the normal command in SPSS for your statistical analysis you activate "Past" that opens the syntax window. In this way yiu have all the instructions automatically created. But sometimes you need to change or add new lines to the suntax...Also SPSS has a book about syntax commands .
Thanks a lot for your suggestion. I've been trying those syntax long before I asked for help because what I'm trying to do is much more complex than that. Breifly, what I need to do is:
- take a random sample n=60
- compare means on one variable between two groups
- run repeated measures anova
- repeat this k times
- show within a table only means, Sd's a p-values for mean comparison and F and p-values for the interaction in each RM Anova for each random sample.
I've been trying with the LOOP command, but no success yet. Can you see why I need some help, right? :)
See if this helps you for repeated measures (for random sample it is easy to add that information, doing Past) Toc compare means with repeated measures i used this comands according to post-hoc or priori tests:
post-hoc tests
"if there are differences between the means of groups interested in locating them and may resort to that of a posteriori test (post-hoc) or to a priori tests (contrast). The analysis begins with the interaction between the two factors and then interpreting the main effects. These studies are done by Syntax cap11_exercicio1_interaçoes.sps where the line 3 indicates that the design is repeated measures; 5 gives the line power and the effect size; and lane 6 shows evidence that the errors are evaluated in each group stress. If the interest were to compare the groups in each event, line 6 would be REPLACED by / WSDESIGN mwithin n_erros_provas (1), mwithin n_erros_provas (2), mwithin n_erros_provas (3)."(see file attached about syntax comands (doc3).
Prior tests:
If interested in the errors of the race without familiarity with the familiarly, is created in Syntax for each stress level separate the analyzed contrast whose hitpóteses are: • μ - μ + μ = 0 1 2 3: 2 [] 0 test test provaH. • μ - μ + μ ≠ 1 2 3: 2 [] 0a proof proof provaH.
It is acceded to the Syntax window via the File Open command Syntax cap11_exercicio1_interaçoes.sps where mark the lines 17-22 followed by Run Selection. Line 18 sorts the database according to the stress levels; 19 line allows the separate analysis for each stress category; the line 21 indicates that the model is repeated measures on errors in 3 tests; line 22 indicates the contrast study whose coefficients (2, -1, -1) fall after each test.(see file attached about this comands)
Sorry, I did not get the problem right in the first place. It is always hard to help without knowing the actual syntax. If you still have issues, feel free to post your syntax and we'll see what we can do. Right now, we can only guess where the problem is.
I have written this syntax for 1) random sampling, 2) t-test for three variables, and 3) RM ANOVA for group*time.
USE ALL
do if $casenum=1.
compute #s_$_1=60.
compute #s_$_2=6000.
end if.
do if #s_$_2 > 0.
compute filter_$=uniform(1)* #s_$_2 < #s_$_1.
compute #s_$_1=#s_$_1 - filter_$.
compute #s_$_2=#s_$_2 - 1.
else.
compute filter_$=0.
end if.
VARIABLE LABELS filter_$ '60 de los primeros 6000 casos (SAMPLE)'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
T-TEST GROUPS=Selecc_grupo3(0 1)
/MISSING=ANALYSIS
/VARIABLES=Educación Pre Post
/CRITERIA=CI(.95).
GLM Pre Post BY Selecc_grupo3
/WSFACTOR=factor1 2 Polynomial
/METHOD=SSTYPE(3)
/CRITERIA=ALPHA(.05)
/WSDESIGN=factor1
/DESIGN=Selecc_grupo3.
EXECUTE.
However, when I introduce LOOP #K = 1 TO 10 at the beggining and END LOOP and the end, it shows an error and does not run the analyses anymore.
The second thing is that using that syntax, when the analyses are repeated 10 times, the output will show all the results for each analysis. Could it be shown within one single table?
#1: Do you write EXE. after END LOOP.? ;) Did you try running a shorter loop with your exact syntax as well? I am not sure yet, whether the error is due to the loop or the syntax in the middle. Here are some different options for looping, which I find very useful: http://www.spss-tutorials.com/spss-loop-command/
#2: I don't think so. At least this in nothing I would use another programme to make the tables and charts look pretty anyway.
Hello there, just in case someone is interested in SPSS 23, it is now available in cloud with 30-day free trial and great price after. take a look at https://www.apponfly.com/en/ibm-spss-statistics-base?KAI