StatLabStudent EditionUser guideGalleryFeaturesAbout

Command syntax reference

Every StatLab dialog can write its command into the Syntax editor with Paste; you can also type commands, save them as a .sps file and run them again on new data. The commands follow the style taught in most statistics courses.

How do I use the Syntax editor?

Which commands are available?

TaskCommand
FrequenciesFREQUENCIES VARIABLES=gender group /STATISTICS=ALL /BARCHART.
DescriptivesDESCRIPTIVES VARIABLES=age score /STATISTICS=MEAN STDDEV MIN MAX VARIANCE SKEWNESS KURTOSIS.
ExploreEXAMINE VARIABLES=score BY group /PLOT=BOXPLOT HISTOGRAM.
CrosstabsCROSSTABS /TABLES=smoker BY gender /STATISTICS=CHISQ PHI CC /CELLS=COUNT EXPECTED ROW.
One-sample t testT-TEST /TESTVAL=40 /VARIABLES=age.
Independent-samples t testT-TEST GROUPS=gender(1 2) /VARIABLES=score.
Paired-samples t testT-TEST PAIRS=pre WITH post (PAIRED).
One-way ANOVAONEWAY score BY group /STATISTICS=DESCRIPTIVES HOMOGENEITY WELCH /POSTHOC=TUKEY ALPHA(0.05).
Pearson correlation (+ scatterplot)CORRELATIONS /VARIABLES=age score /SCATTER.
Spearman correlationNONPAR CORR /VARIABLES=q1 q2 /PRINT=SPEARMAN.
Linear regressionREGRESSION /DEPENDENT score /METHOD=ENTER age pre q1 /RESIDUALS HISTOGRAM(ZRESID).
Cronbach's alphaRELIABILITY /VARIABLES=q1 q2 q3 q4 q5 /MODEL=ALPHA.
Mann-Whitney UNPAR TESTS /M-W=q1 BY gender(1 2).
Wilcoxon signed-rankNPAR TESTS /WILCOXON=pre WITH post (PAIRED).
Kruskal-Wallis HNPAR TESTS /K-W=score BY group.
HistogramGRAPH /HISTOGRAM(NORMAL)=score.
Bar chart of meansGRAPH /BAR(SIMPLE)=MEAN(score) BY group.
ScatterplotGRAPH /SCATTERPLOT(BIVAR)=pre WITH post /FIT.
BoxplotEXAMINE VARIABLES=score BY group /PLOT=BOXPLOT /STATISTICS=NONE.
ComputeCOMPUTE sat = MEAN(q1, q2, q3, q4, q5).
VARIABLE LABELS sat 'Satisfaction (mean)'.
Conditional computeIF (group = 3) bonus = score + 5.
Recode into a new variableRECODE age (LO thru 29 = 1) (30 thru 49 = 2) (50 thru HI = 3) INTO agegrp.
Filter cases (keep the rest)FILTER IF (gender = 2).
Delete unselected casesSELECT IF (age >= 18).
Remove the filterFILTER OFF.
SortSORT CASES BY age(D).
Value labelsVALUE LABELS gender 1 'Male' 2 'Female'.
Missing valuesMISSING VALUES income (99999).

StatLab additions: FILTER IF (condition). and FILTER OFF. (keep but ignore cases), CORRELATIONS … /SCATTER, and PROC name /option=value … for add-on procedures. Commands that StatLab does not know are reported with their line number and skipped.

Open StatLab   All guide topics