Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Statscraft 0.7.0, release v0.7.0

Commands

One page per supported command, generated from statscraft help of Statscraft 0.7.0.

CommandWhat it does
DATA LISTDefine text data, inline or in a file, and read it as the new active dataset.
BEGIN DATAInline data for the DATA LIST before it, up to a line that holds END DATA.
INPUT PROGRAMStart an input program: commands that build the cases of a new active dataset.
END INPUT PROGRAMEnd an input program and run it.
END CASEIn an input program: add the case built so far to the dataset and go on.
END FILEIn an input program or FILE TYPE: stop reading; the case being built is dropped.
LEAVEKeep the values of new variables from case to case instead of resetting them.
REREADIn an input program: let the next DATA LIST read the last record again.
REPEATING DATAIn an input program or FILE TYPE: one case per repeating group of a record.
FILE TYPEStart the definition of a file with several kinds of records.
RECORD TYPEInside FILE TYPE: the record types the following DATA LIST reads.
END FILE TYPEEnd a FILE TYPE definition and read the file.
MATRIX DATARead matrix materials (correlations, means, counts) as a matrix data file.
MATRIXRun a program in the matrix language, up to END MATRIX.
GETRead a data file and make it the active dataset.
SAVEWrite the active dataset to a data file.
VARIABLE LABELSSet the labels of variables.
VALUE LABELSReplace the value labels of variables.
MISSING VALUESDeclare user-missing values.
VARIABLE LEVELSet the measurement level of variables.
VARIABLE WIDTHSet how many characters wide variables show in the data grid.
FORMATSSet the display format of variables.
FREQUENCIESFrequency tables, summary statistics and percentiles.
EXECUTERun the pending transformations.
COUNTCount, per case, how many variables hold one of the listed values.
SORT CASESSort the cases by the values of variables.
SORT VARIABLESPut the variables in order by a property of their dictionary entries.
RENAME VARIABLESChange the names of variables.
DELETE VARIABLESRemove variables from the dataset.
WEIGHTWeight the cases by a variable, or turn weighting off.
AGGREGATEAggregate groups of cases into new variables or a new dataset.
VARSTOCASESTurn groups of variables into cases: one new case per variable of the group.
CASESTOVARSTurn groups of cases into one case each, with a variable per value of an index.
FLIPTranspose the data: variables become cases and cases become variables.
SPLIT FILERun each procedure on every group of adjacent cases with the same values.
FILTERLeave out of procedures the cases whose filter value is 0 or missing.
TEMPORARYMake the changes that follow last only until the next procedure.
N OF CASESKeep only the first n cases from the next data pass on.
NShort for N OF CASES.
SAMPLEKeep a random sample of the cases.
AUTORECODERecode values into consecutive integers in new variables, labelled with the old values.
RANKRanks, percentile groups, proportion estimates, normal and Savage scores as new variables.
COMPUTEAssign the value of an expression to a variable.
IFAssign a value only for the cases where a condition holds.
SELECT IFKeep only the cases where a condition holds.
RECODEMap values of variables to new values.
STRINGDeclare new string variables, filled with empty strings.
NUMERICDeclare new numeric variables, filled with system-missing.
DO IFStart a block of transformations that run only where a condition holds.
ELSE IFStart the next conditional branch of a DO IF block.
ELSEStart the branch of a DO IF block for the cases no condition matched.
END IFEnd a DO IF block.
DO REPEATRepeat transformations with stand-in names replaced by variables or values.
LOOPRepeat transformations for each case, with an index, a condition or both.
END LOOPEnd a LOOP, optionally when a condition holds.
BREAKLeave the innermost LOOP, usually inside DO IF.
VECTORName a range of variables, or new variables, as a vector for indexed use.
CTABLESCustom tables: counts, percentages and statistics by categories.
MRSETSDefine, delete and list multiple response sets.
DESCRIPTIVESSummary statistics of numeric variables, optionally saved as z-scores.
CROSSTABSContingency tables with percentages, residuals and chi-square tests.
MULT RESPONSEFrequency tables and crosstabulations of multiple response groups and variables.
MEANSStatistics of dependent variables within groups of control variables.
T-TESTOne-sample, independent-samples and paired-samples t tests with effect sizes.
ONEWAYOne-way analysis of variance with contrasts and post hoc comparisons.
CORRELATIONSPearson correlations with significance and case counts.
NONPAR CORRSpearman’s rho and Kendall’s tau-b rank correlations with significance.
PARTIAL CORRPartial correlations of variables controlling for others, with significance.
NPAR TESTSNonparametric tests: one-sample, two and k related samples, two and k independent samples.
EXAMINEDescriptives, percentiles, M-estimators, extreme values and normality tests, by factor cells.
REGRESSIONLinear regression with forced entry or removal and stepwise selection, residuals and diagnostics.
RELIABILITYReliability of a scale: Cronbach’s alpha, split-half and other models, item statistics and ICC.
FACTORFactor analysis: principal components and six factoring methods, rotations, factor scores.
QUICK CLUSTERK-means clustering of cases into a given number of clusters.
CLUSTERHierarchical clustering of cases by one of 37 proximity measures and seven methods.
DISCRIMINANTLinear discriminant analysis with direct or stepwise entry and classification of cases.
LOGISTIC REGRESSIONBinary logistic regression with categorical covariates, stepwise selection and case diagnostics.
UNIANOVAGeneral linear model of one dependent variable: factorial ANOVA, ANCOVA and regression.
GLMGeneral linear model: one dependent variable as in UNIANOVA, or repeated measures with WSFACTOR.
ANOVAAnalysis of variance for factorial designs with covariates, the older form with MCA tables.
TREEA classification tree grown by CHAID or exhaustive CHAID.
REPORTCase listings and summary statistics by break groups, laid out as a report.
ADD FILESAppend the cases of several data files, matching variables by name.
MATCH FILESCombine the variables of several data files case by case or by key.
STAR JOINAdd the fields of lookup files to every case of a data file, by keys, as an SQL left join.
UPDATEReplace values of a primary file with the values of transaction files, by key.
DEFINEDefine a macro: a name that stands for syntax, with arguments.
INSERTRun the commands of another syntax file in place of this command.
INCLUDERun the commands of another syntax file, read by the batch rules.
BEGIN PROGRAMA block of code in another programming language; it is skipped with a warning.
SETChange settings of the session.
SHOWShow the current settings.
PRESERVEStore the current settings and folder, to bring them back with RESTORE.
RESTOREBring back the settings and folder the last PRESERVE stored.
CACHEAccepted and has nothing to do: the data are always kept in memory.
CDChange the folder relative file names start from.
FILE HANDLEGive a file or a folder a short name to use in place of its path.
DATASET NAMEGive the active dataset a name, so that it stays open when another one becomes active.
DATASET ACTIVATEMake a named dataset the active one.
DATASET COPYCopy the active dataset, as it is now, into a named dataset.
DATASET DECLAREReserve a dataset name for a dataset that a later command creates.
DATASET CLOSEClose a named dataset, or take the name off the active one.
DATASET DISPLAYList the open datasets.
OUTPUT NEWStart a new output document, which gets the tables from now on.
OUTPUT NAMEName the output document that gets the tables.
OUTPUT ACTIVATESend the tables from now on to an open output document.
OUTPUT CLOSEClose an output document, or all of them.
OUTPUT DISPLAYList the open output documents.
OUTPUT EXPORTWrite the tables of an output document to an Excel workbook, web page, text or CSV file.
USEUse all cases, or a range of cases, in the commands that follow.
DISPLAYShow dictionary information of the active dataset.
LISTList the values of cases.
ADD VALUE LABELSAdd or change value labels, keeping the other labels of the variables.
FILE LABELSet the label of the data file.
DOCUMENTAdd free text to the documents of the data file.
ADD DOCUMENTAdd quoted lines to the documents of the data file.
DROP DOCUMENTSRemove the documents of the data file.
VARIABLE ROLESet the role of variables for dialogs.
VARIABLE ALIGNMENTSet the alignment of variables in the data grid.
VARIABLE ATTRIBUTESet or delete custom attributes of variables.
DATAFILE ATTRIBUTESet or delete custom attributes of the data file.
ALTER TYPEChange the type, string width or format of variables.
APPLY DICTIONARYCopy dictionary information from a data file or dataset to the active dataset.
GET DATARead a text data file or a sheet of a workbook as the active dataset.
SAVE TRANSLATEWrite the active dataset to a CSV or tab-delimited text file or an Excel workbook.
TITLEPut a title in the output, above the output that follows.
SUBTITLEPut a subtitle in the output, above the output that follows.
ECHOShow a text in the output.
NEW FILEStart a new, empty active dataset.
CLEAR TRANSFORMATIONSUndo the transformations and dictionary changes since the last data pass.
ERASEDelete a file.
SYSFILE INFOShow the dictionary of a data file without opening it as the active dataset.
PERMISSIONSMake a file read-only, or writeable for its owner.
HOSTRefused: Statscraft never runs operating system commands from syntax.
FINISHEnd the job: the commands after it are not read.
DATEAdd date variables that count the cases of a time series.
PRINTShow the values of variables for every case, as lines of text.
PRINT EJECTLike PRINT, starting a new page each time it runs.
PRINT SPACEAdd blank lines to the PRINT output, for every case it runs on.
WRITEWrite the values of variables for every case to a text file.
PRINT FORMATSSet the print format of variables: how procedures and PRINT show them.
WRITE FORMATSSet the write format of variables: how WRITE writes them.
XSAVEWrite the cases to a data file as the next data pass reads them.

General rules

A command ends with a period at the end of a line, at a blank line, or at the end of input.
Command names and keywords are case-insensitive and may be shortened to three or more letters.
varlist: variable names, a range written as first TO last, or ALL.
Strings use single or double quotes; double the quote character to include it. A string may
run on over line breaks, which it keeps; 'a' + 'b' joins two strings into one.
Comments: a command starting with * or COMMENT, or /* text */ inside a line.
Expressions: + - * / **, = <> < > <= >= (or EQ NE LT GT LE GE), AND OR NOT (or & | ~),
functions such as MEAN(a, b) or SUM(q1 TO q5); LAG(var [, n]) is the value n cases back.
A function name may be shortened to three or more letters that start no other function.
Scratch variables start with #: they begin at 0 or blank, keep their value from case to case,
are never saved and are gone when the next procedure starts. $CASENUM is the case number.

Functions of expressions (COMPUTE, IF, SELECT IF, DO IF, ELSE IF, LOOP IF, END LOOP IF):
Arithmetic: ABS RND TRUNC MOD SQRT EXP LN LG10 LNGAMMA SIN COS TAN ARSIN ARCOS ARTAN.
Statistical, with .n for the valid values needed (MEAN.2): SUM MEAN MEDIAN MIN MAX SD VARIANCE
CFVAR. Missing values: MISSING SYSMIS VALUE NMISS NVALID. Logical: ANY RANGE. Also LAG and
VALUELABEL.
Strings: CONCAT LENGTH CHAR.LENGTH UPCASE LOWER LTRIM RTRIM NTRIM SUBSTR CHAR.SUBSTR INDEX
CHAR.INDEX RINDEX CHAR.RINDEX LPAD CHAR.LPAD RPAD CHAR.RPAD REPLACE STRUNC CHAR.MBLEN
MBLEN.BYTE NORMALIZE NUMBER STRING.
Dates and times: DATE.DMY DATE.MDY DATE.MOYR DATE.QYR DATE.WKYR DATE.YRDAY YRMODA TIME.DAYS
TIME.HMS CTIME.DAYS CTIME.HOURS CTIME.MINUTES CTIME.SECONDS XDATE.DATE XDATE.HOUR XDATE.JDAY
XDATE.MDAY XDATE.MINUTE XDATE.MONTH XDATE.QUARTER XDATE.SECOND XDATE.TDAY XDATE.TIME
XDATE.WEEK XDATE.WKDAY XDATE.YEAR DATEDIFF DATESUM (units years quarters months weeks days
hours minutes seconds; DATESUM methods 'closest', the default, and 'rollover').
Distributions: CDFNORM PROBIT, and CDF.d IDF.d PDF.d NCDF.d NPDF.d SIG.d RV.d where the
distribution d has them: BERNOULLI BETA BINOM BVNOR CAUCHY CHISQ EXP F GAMMA GEOM HALFNRM HYPER
IGAUSS LAPLACE LNORMAL LOGISTIC NEGBIN NORMAL PARETO POISSON SMOD SRANGE T UNIFORM WEIBULL
(NCDF and NPDF: BETA CHISQ F T; SIG: CHISQ F). UNIFORM(max), NORMAL(sd) and the RV functions
draw random numbers. An argument out of range gives system-missing.

Not supported yet

These commands of the language are recognised, but Statscraft does not run them yet. A script that uses one stops with the error “command … is not supported yet” at its line, and nothing is changed.

EXPORT, GET TRANSLATE, GRAPH, IMPORT, OUTPUT SAVE