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

Statscraft

A statistics workbench written in Rust: a command-line engine first, a desktop application after. It reads .sav files, runs the established statistics command syntax, and is built to be driven by people and AI agents alike: sessions that keep the data between partial runs, JSON output, errors with line and column, and help generated from the parser.

Statscraft is an independent project. It is not affiliated with the GNU PSPP project or the ArtCraft suite.

Status: early development. Licensed under MIT.

statscraft describe tests/fixtures/survey_basic.sav --json    dictionary and counts of a file
statscraft run job.sps                                        run a syntax file
statscraft run -s work --lines 1-6 job.sps                    run some lines in a session that keeps the data
statscraft check -s work job.sps                              validate without saving anything
statscraft run job.sps --xlsx tables.xlsx                     also write every table to an Excel workbook
statscraft help CTABLES                                       syntax of one command
statscraft-gui tests/fixtures/survey_basic.sav job.sps        the desktop window

(job.sps is the example from Getting started.)

What runs today: reading and writing data files, labels and missing values, transformations (COMPUTE, IF, DO IF, RECODE, COUNT, SELECT IF, AGGREGATE, SORT CASES, merging files), FREQUENCIES, DESCRIPTIVES, CROSSTABS, MEANS, T-TEST, ONEWAY, CORRELATIONS, NONPAR CORR, PARTIAL CORR, NPAR TESTS, EXAMINE, linear regression (REGRESSION, with stepwise selection, residuals and diagnostics), scale reliability (RELIABILITY: alpha, split-half and other models, intraclass correlations), logistic regression (LOGISTIC REGRESSION, with categorical covariates, stepwise selection and case diagnostics), the general linear model (UNIANOVA and GLM: factorial ANOVA and ANCOVA with Type I to IV sums of squares, estimated marginal means, post hoc tests, contrasts and repeated measures, and the older ANOVA with MCA tables), discriminant analysis (DISCRIMINANT, direct and stepwise, with classification), hierarchical clustering (CLUSTER, 37 proximity measures and seven methods), classification trees (TREE by CHAID and exhaustive CHAID), and custom tables (CTABLES) with multiple response sets and significance tests. The command pages list every command.

DATA LIST reads text data in fixed columns, freefield (FREE) or one case per line (LIST), inline between BEGIN DATA and END DATA or from a file, and warns with the line number of every value it cannot read.

SPLIT FILE runs every procedure per group of adjacent cases, LAYERED in one table or SEPARATE, FILTER leaves cases out of procedures without deleting them, TEMPORARY makes the changes after it last until the next procedure, N OF CASES keeps the first cases and SAMPLE a random sample; split and filter stay with the session’s dataset.

Scratch variables (#name) start at 0 or blank, keep their value from case to case and are gone at the next procedure; LAG gives a variable’s value in an earlier case as that case ended the data pass, and a pass that needs earlier cases runs case by case.

DO REPEAT repeats transformations with stand-ins replaced by variables or values (END REPEAT PRINT lists the generated commands), LOOP repeats them per case with an index, IF conditions and BREAK, and VECTOR names a range of existing or new variables for indexed use such as v(#i).

RANK saves ranks, fractional ranks, percentile groups, proportion estimates, normal and Savage scores as new variables, within groups of BY variables, with the four ways of treating ties.

AUTORECODE turns the values of variables into consecutive codes in new variables, labelled with the old values or their labels, in ascending or descending order, with user-missing values last and one scheme for several variables with /GROUP.

TREE grows a classification tree for a nominal or ordinal dependent by CHAID or exhaustive CHAID: predictor categories merged by significance, Bonferroni-adjusted splits, scale predictors cut into groups of equal size, missing values as a floating category, and the usual growth limits. It shows the tree as a table, the model summary, risk, classification and gain tables, and saves the node, the predicted category and the predicted probabilities. CRT and QUEST are not supported yet.

Statscraft 0.7.0, release v0.7.0

Getting started

Statscraft has two programs:

  • statscraft, the command line. It reads .sav and .zsav files, runs syntax and prints tables as Markdown or JSON.
  • statscraft-gui, the desktop window over the same engine.

The command line works without the window.

Install

Getting the installer or package

The installer and packages for x86_64 Windows and Linux, and for macOS on Apple silicon and Intel, are attached to a release on the GitHub repository’s Releases page. They come from the Release build workflow, which runs only when someone starts it:

  1. On GitHub open Actions, choose Release build, then Run workflow (with the GitHub CLI: gh workflow run release.yml). Tick draft release to also get a draft release with the files attached; a maintainer publishes it by hand.
  2. When the run has finished, its page lists the files below, where X is the version:
    • statscraft-X-windows-x86_64-setup.exe, the Windows installer
    • statscraft-X-windows-x86_64.zip, the same programs for Windows without an installer
    • statscraft_X_amd64.deb, the package for Debian and Ubuntu
    • statscraft-X-linux-x86_64.tar.gz, the same files for any other Linux
    • statscraft-X-macos-universal.tar.gz, Statscraft.app and the command line for macOS
    • SHA256SUMS, the checksums of these files

Windows

Run statscraft-X-windows-x86_64-setup.exe. It needs no administrator rights and installs for your user only:

  • both programs go to %LOCALAPPDATA%\Programs\Statscraft
  • the Start menu gets Statscraft, which opens the window
  • that folder is added to your PATH, so statscraft works in any terminal you open after the installation
  • .sav and .zsav files open in the window, and .sps files in its syntax editor. Where another program is already the default for one of these types, it stays the default, and Statscraft is offered under Open with.

Windows may warn that the installer comes from an unknown publisher, because it is not signed yet. Choose More info, then Run anyway.

To uninstall, open Settings, Apps, Installed apps, find Statscraft and choose Uninstall. That removes the programs, the Start menu entry, the PATH entry and the file types.

Windows without an installer

The portable statscraft-X-windows-x86_64.zip needs no installation and no administrator rights, so it also works where you may not install programs. Unpack it anywhere you can write, for example to a folder in Documents or on a USB stick (in Explorer: right-click, Extract All). The folder statscraft-X-windows-x86_64 holds:

  • statscraft-gui.exe, the window: double-click it to start Statscraft
  • statscraft.exe, the command line: run it in a terminal from that folder, or add the folder to your PATH
  • LICENSE.txt and README.md

Nothing is registered: there is no Start menu entry and no file types, so open files with File, Open or drag them onto statscraft-gui.exe. Windows may warn about an unknown publisher the first time, as for the installer: More info, then Run anyway. To remove it, delete the folder.

Keep LICENSE.txt next to the programs: the updater recognises the portable copy by it, and updates the two programs in that folder.

macOS

statscraft-X-macos-universal.tar.gz runs on Apple silicon and on Intel Macs. Double-click it in Finder to unpack it. The folder statscraft-X-macos-universal holds:

  • Statscraft.app, the window: drag it to Applications
  • statscraft, the command line
  • LICENSE and README.md

Statscraft is not signed with an Apple Developer ID yet, so the first time you open it macOS says it cannot verify the app. Click Done (not Move to Trash), then:

  1. Choose Apple menu > System Settings, then Privacy & Security in the sidebar.
  2. Under Security, find the message about Statscraft and click Open Anyway. The button is there for about an hour after you tried to open the app.
  3. Enter your login password and click OK.

After that, Statscraft.app opens with a double-click like any other app.

The command line needs the same once. Move it to a folder on your PATH, for example:

mkdir -p ~/.local/bin
mv ~/Downloads/statscraft-X-macos-universal/statscraft ~/.local/bin/

(add export PATH="$HOME/.local/bin:$PATH" to ~/.zshrc if that folder is not on your PATH yet). The first statscraft --version is blocked; allow it under Privacy & Security as above and run it again. Instead of that, you can clear the download mark in the terminal: xattr -d com.apple.quarantine ~/.local/bin/statscraft.

Finder offers Statscraft under Open With for .sav, .zsav and .sps files. Opening a file this way should open it in the window, as if it had been dropped there; this has not been tried on a Mac yet. If Statscraft starts without the file, use File, Open, and please report it (Help, Bug report). To uninstall, move Statscraft.app to the Bin and delete the statscraft program.

Debian and Ubuntu

sudo apt install ./statscraft_X_amd64.deb

puts statscraft and statscraft-gui in /usr/bin, adds Statscraft to the applications menu and opens .sav, .zsav and .sps files in the window. sudo apt remove statscraft uninstalls it.

Other Linux

The tarball holds a bin and a share folder. Unpack it into ~/.local and refresh the file types:

tar -xzf statscraft-X-linux-x86_64.tar.gz --strip-components=1 -C ~/.local
update-mime-database ~/.local/share/mime
update-desktop-database ~/.local/share/applications

(update-desktop-database comes with desktop-file-utils; where it is missing, skip that line.) ~/.local/bin must be on your PATH, which it is by default on most distributions once the folder exists. To uninstall, delete what the tarball put there:

cd ~/.local
rm bin/statscraft bin/statscraft-gui share/applications/statscraft.desktop share/mime/packages/statscraft.xml
rm share/icons/hicolor/*/apps/statscraft.png share/icons/hicolor/scalable/apps/statscraft.svg
rm -r share/doc/statscraft
update-mime-database ~/.local/share/mime

Updating

When a new version is published, the window says so in a bar under the menu: Update now installs it, Later hides the bar. From the command line, statscraft update --check tells whether there is one and statscraft update installs it. How it works for each kind of installation:

  • Windows: the new installer is downloaded, checked and run silently; the window closes and opens again in the new version. Save your work first.
  • Windows without an installer: the new .zip is downloaded and checked, and the two programs in its folder are replaced; restart the window to use the new one. The old programs are deleted the next time Statscraft starts.
  • Tarball under ~/.local: the two programs in ~/.local/bin are replaced; restart the window to use the new one.
  • Debian and Ubuntu: the new .deb is downloaded and checked into ~/Downloads, and you install it with the command shown, sudo apt install ~/Downloads/statscraft_X_amd64.deb.
  • macOS: the bar has a Download link to the new statscraft-X-macos-universal.tar.gz. Unpack it and replace Statscraft.app in Applications (and the statscraft program) with the new ones. The first start of the new version needs Open Anyway again. The updater does not change files inside the app itself, which a later signed version would not allow. statscraft update on macOS says where the new release is.

Every download is checked against the checksums published with the release before it is used. The window checks at most once a day, sending only one request to GitHub and nothing about you or your data. It is on by default and silent unless there is an update; Edit, Settings, Updates turns it off. See the window and the command line.

Build from source

You need Rust 1.95 or newer (rustc --version shows yours; rustup update stable gets a newer one).

git clone https://github.com/statscrafthq/statscraft
cd statscraft
cargo build --release -p statscraft -p statscraft-gui

The programs are then in target/release/. The examples below call them statscraft and statscraft-gui; put target/release on your PATH, or write the full path.

Open a .sav file

All examples run from the root of the repository and use its synthetic test data in tests/fixtures/.

statscraft describe tests/fixtures/survey_basic.sav

prints the size of the file and one line per variable: name, format, measurement level, number of valid values and label.

200 cases, 19 variables
resp_id	F6.0	nominal	valid 200	Respondent ID
gender	F1.0	nominal	valid 200	Gender
age	F3.0	scale	valid 200	Age in years
region	F1.0	nominal	valid 200	Region of residence
q1_satisfaction	F2.0	ordinal	valid 179	Q1. Overall, how satisfied are you with our service?
...

Add --json for the full dictionary: value labels, missing values, counts of system- and user-missing values, the weight variable and multiple response sets. See the command line.

Run a syntax file

Save these lines as job.sps:

GET FILE='tests/fixtures/survey_basic.sav'.
FREQUENCIES VARIABLES=gender region.

RECODE age (LOWEST THRU 34 = 1) (35 THRU 54 = 2) (55 THRU HIGHEST = 3) INTO age_group.
VARIABLE LABELS age_group 'Age group'.
VALUE LABELS age_group 1 'Under 35' 2 '35 to 54' 3 '55 and over'.

CROSSTABS /TABLES=age_group BY gender /CELLS=COUNT COLUMN /STATISTICS=CHISQ.

and run it:

statscraft run job.sps

Every table comes out as Markdown, followed by a summary of the run:

### gender: Gender

| Category | Value | Label | Frequency | Percent | Valid Percent | Cumulative Percent |
| --- | --- | --- | --- | --- | --- | --- |
| valid | 1 | Male | 106 | 53 | 53 | 53 |
| valid | 2 | Female | 88 | 44 | 44 | 97 |
| valid | 3 | Other or prefer to self-describe | 6 | 3 | 3 | 100 |
| total |  |  | 200 | 100 |  |  |
...
dataset loaded: 200 cases, 20 variables
ran 6 command(s)

Nothing is written to disk unless the syntax says SAVE OUTFILE='...'.

To see what a command accepts:

statscraft help                 every supported command and the general rules
statscraft help CROSSTABS       the syntax of one command, with an example

The same text is in the command pages.

Keep the data between runs: sessions

A session keeps the dataset between runs, so you can run a long script piece by piece:

statscraft run -s demo --lines 1-1 job.sps        GET only: the session now holds the file
statscraft run -s demo --lines 4-6 job.sps        RECODE and the labels
statscraft run -s demo -e "FREQUENCIES VARIABLES=age_group."
statscraft describe -s demo

The second run prints variables added: age_group and ran 3 command(s), session saved. A run is all or nothing: when one command fails, the session stays as it was, so you fix the line and run the same range again.

A session also keeps the macros its runs defined (DEFINE, or a macro library brought in with INCLUDE) and the macro settings of SET (MEXPAND, MPRINT, MNEST, MITERATE), so a library included once serves every later run.

Sessions live in .statscraft/sessions/<name>/ under the current folder. Delete that folder to start over.

The window in five minutes

Start the window with a data file and a syntax file:

statscraft-gui tests/fixtures/survey_basic.sav job.sps

(Both are optional. From a source checkout cargo run -p statscraft-gui -- tests/fixtures/survey_basic.sav job.sps does the same.)

  1. Data shows the cases. Double-click a cell, or press Enter, to change it. Show value labels, over the grid, switches value labels on and off.
  2. Variables has one row per variable. Double-click a label, a format or the missing values to change them.
  3. Syntax holds job.sps. Select lines 4 to 6 and press Ctrl+Enter to run only those commands. F1 shows help for the command under the cursor. An error is marked at its line and column.
  4. Output collects every table. Copy puts a table on the clipboard for a spreadsheet; File, Export output as Excel saves all tables as a workbook.
  5. The menus Data, Analyze and Transform open dialogs that build syntax. OK runs it, Paste puts it in the syntax editor.

Everything the window does is syntax: the log under the Syntax and Output views lists every command it ran, and Copy syntax there gives a script that repeats your session with statscraft run. Edit, Undo last change (Ctrl+Z) takes back the last run that changed the data.

The grid draws only the visible cells, so large files stay quick. Arrows, Page Up and Down, Home and End move the selection, Ctrl+Home and Ctrl+End go to the first and last cell, and Tab and Shift+Tab move to the next and previous cell, committing an edit on the way. Long lines in the syntax editor wrap; View turns that off. The window brings its own fonts; set STATSCRAFT_FONT or STATSCRAFT_MONO_FONT to a .ttf file to use another.

While the window is open, the command line and AI agents can work in it as the session gui:

statscraft run -s gui -e "FREQUENCIES VARIABLES=age_group."

The table appears in the window’s Output tab. See the command line and AI agents.

Next

  • The command line: every subcommand, flag, JSON shape and exit code.
  • AI agents: how an agent should drive Statscraft.
  • Commands: one page per supported command.
  • Differences: where Statscraft differs from other implementations, and what is not supported yet.

Statscraft 0.7.0, release v0.7.0

The window

statscraft-gui survey.sav job.sps     open a data file and a syntax file

statscraft-gui is a desktop window over the same engine, in four tabs. Files dropped on the window from the file manager open too: a .sav or .zsav file as data, a workbook or text file (.xlsx, .xlsm, .xls, .csv, .txt, .tab, .dat) in the Open Data dialog, a .sps file in the syntax editor (one data file and one syntax file at a time; the status bar names the files left out). On macOS a .sav, .zsav or .sps file opened from Finder (a double-click or Open With) is meant to open the same way; this is not yet tested on a Mac.

  • Data: the cases in a grid that draws only the visible cells, with value labels on or off (Show value labels, over the grid). Each column draws its values and labels with the variable’s alignment (numbers to the right and strings to the left when the file sets none); a value or label too wide for its column is cut short with an ellipsis and keeps that alignment. A system-missing value shows as a small grey dot, an empty string as nothing. While FILTER BY is in force, the row number of every case the filter leaves out has a diagonal stroke through it; the case stays in the grid. Double-click a cell or press Enter to change it; Enter commits, Escape cancels. Arrows, Page Up and Down, Home and End move the selection, Ctrl with an arrow goes to the first or last row or column, Ctrl+Home and Ctrl+End to the first and last cell, and Tab and Shift+Tab move to the next and previous cell, committing an edit on the way. Shift with those keys, or Shift+click, extends the selection to a block; a click on a row number or a column name selects the whole case or variable (Shift+click a range, Ctrl+click one more or one less). Dragging across cells selects the block, across column names or row numbers the variables or cases in between. Ctrl+C copies the selection as tab-separated text with the variable names as the first line, for a spreadsheet or a text editor; one cell copies as its text alone, and more than two million cells are not copied. Delete asks to delete the variables whose columns are selected; with cells selected it clears them (IF (RANGE($CASENUM, 2, 4)) age = $SYSMIS., a blank for a string), and Ctrl+Z brings them back. A column is as wide as the variable’s display width (the width a .sav file keeps for each variable); drag the border at the right of its name to change it, which runs VARIABLE WIDTH var (n)., so the width is saved with the data.
  • Variables: one row per variable with name, type, format, width, decimals, label, value labels, missing values, columns (the display width, as wide as the Data View shows it), alignment, measure and role. Double-click to change a field. The type (Numeric, Date or String) and the format open a small dialog that offers only formats there are, numbers (plain, comma, dot, dollar, percent, scientific, leading zeros), dates and times, and strings, with the width and decimals as numbers within that format’s limits; it runs FORMATS, or ALTER TYPE for a new type or string width (a new type drops value labels and missing values, and the dialog says so). Value labels open an editor with one row per code and label to change, add and remove, which runs VALUE LABELS with the whole set; or Paste many, a text area for many lines of a code and a label with a tab, semicolon, equals sign or comma between (the first of these the text holds), which either updates (ADD VALUE LABELS: new codes added, the labels of codes there are changed) or replaces the whole set (VALUE LABELS). Missing values open an editor for up to three values, or for numbers a range (LO and HI for the lowest and highest value) and one value more, which runs MISSING VALUES. When the variable’s row is one of several selected rows, both editors can give the same labels or missing values to the other selected variables of its type. Columns runs VARIABLE WIDTH, alignment VARIABLE ALIGNMENT and role VARIABLE ROLE, chosen from a list like the measure. A variable without an alignment or role in the file shows numbers to the right, strings to the left and the role Input. The keys, mouse selection and Ctrl+C work as in the Data View, Enter changes the cell at the cursor; Delete deletes the variables whose row numbers are selected, with DELETE VARIABLES, after a question (Edit, Undo last change brings them back). Drag a column border to resize it; these widths are a window setting.

Ctrl+F in the Data View or the Variable View opens a find bar: typing goes to the first variable whose name or label holds the text (any case), Enter or F3 to the next one, Escape closes the bar. The Variable View goes to the variable’s row, the Data View to its column.

A right click opens a menu over what it lands on. On a column name (or the selected columns, when it lands inside them) the menu is short: it sorts the cases ascending or descending by them (SORT CASES), runs Frequencies or Descriptives (numeric variables only) at once, renames the variable, inserts a numeric variable new_1 before it (NUMERIC and MATCH FILES /KEEP, with WEIGHT BY again when a weight is on), copies, or deletes. On a cell it copies, edits or clears the value, keeps only the cases with the same value with a filter (COMPUTE filter_$ = (age = 49)., VARIABLE LABELS and FILTER BY, on the stored value rather than the rounded one shown, VALUE(x) = 99 for a user-missing value, SYSMIS(x) for an empty cell; a variable filter_$ of other data is never overwritten, the next free filter_$_2 is used), stops filtering, opens Select Cases to delete the other cases, or sorts by the variable. On a row number it copies or deletes the case (COMPUTE #row = #row + 1. and SELECT IF #row <> 12.). In the Variable View the menu on row numbers is the one of the columns, and on a cell it starts with Edit for that field. The top of a menu names what it acts on. Items that run syntax wait while a run is going on, and the analyses and sorting are off without cases. Every item runs syntax like any other run, so it shows in the log and Ctrl+Z takes a change back. Deleting variables or a case, sorting while a split is on (sorting ends the split) and Frequencies of more than 100 variables first show the question and the syntax; only a click on the button runs it, Escape cancels.

  • Syntax: an editor with line numbers and colours for command names, subcommands, keywords, strings, numbers, comments, macro words (!name and the words of the macro language) and the period that ends a command. A macro defined with DEFINE in the editor text or in an earlier run of the session is coloured as a macro where it is called, also where a command would stand. Run all, or Run selection (Ctrl+Enter) for the commands on the selected lines; on a line with no command (the empty line under a command just typed) it runs the command above. Errors show at their line and column. While typing, a list offers what fits at the cursor: command names at the start of a command (abbreviations such as FRE or VAL LAB find the full name), subcommands after /, keywords of the command, the variables of the open data with their labels, function names where an expression goes, the macros defined with DEFINE in the text or the session (where a command goes and inside commands), and after ! the words of the macro language. Ctrl+Space opens the list at any point; arrows choose, Enter or Tab puts the choice in, Escape closes it. A command in the list, or a command name under the mouse, shows its summary and syntax; F1 opens the full help of the command at the cursor in a small window.
  • Output: every result table with its multi-level header, beside a navigator that groups the tables by run and command (a run folds away with a click on it). Columns are as wide as their numbers, which align right; long row labels and column headers wrap between words, and a row label repeated under the same outer labels is shown once beside all its rows. The caption and notes follow each table. A run selects nothing, so its tables show without a frame; click a table, or its name in the navigator, to select it (Ctrl+click for more, Ctrl+A for all), and click it again, press Escape or click beside the tables to clear the selection; the syntax of its command shows under the navigator, exactly as it ran, with Copy, Paste (into the syntax editor) and Run again, and pointing at a command in the navigator shows it too; then Copy (Ctrl+C) puts it on the clipboard with its layout for a word processor or spreadsheet and as plain text beside it, Copy as text gives tab-separated text, Delete removes it, and Export selection saves only the selected tables as a web page or an Excel workbook. Right-click a table for the same. Each table is measured once and only the tables in view are drawn, so hundreds of tables scroll smoothly.

File, Open data opens a .sav or .zsav file at once. An Excel workbook (.xlsx, .xlsm, .xls) or a text file (.csv, .txt, .tab, .dat) opens the Open Data dialog first, which writes GET DATA: for a workbook the sheet, whether the first row holds the variable names, and a range such as A1:F200 (empty reads the whole sheet); for a text file the delimiter (comma, semicolon or tab, the one the first line uses most is chosen), whether the first line holds the names, with that line shown, and every variable read as AUTO. After it runs, File, Save data asks for a new .sav file. File, Export data writes SAVE TRANSLATE to an Excel workbook (.xlsx), a CSV file (.csv) or tab-delimited text (.txt), by the name chosen: a first row of variable names, variable labels or none, value labels instead of values, user-missing values as empty, and the variables to export (none: all, in the order of the dataset). An existing file is replaced once the file dialog has asked.

File, Export output as HTML saves the whole output as one web page; File, Export output as Excel saves it as a workbook, with One sheet per table or All tables on one sheet, laid out as --xlsx does. From syntax, OUTPUT EXPORT writes the tables of an output document to a workbook, web page, text or CSV file; OUTPUT NEW, NAME, ACTIVATE and CLOSE group the tables into documents, which the Output view shows together, and the window keeps them from run to run.

The menus have dialogs that build syntax:

  • Data: Define Multiple Response Sets (dichotomy or category sets, counted value, labels, deleting sets), Sort Cases, Split File (groups compared in the same tables or in tables of their own, sorting the cases first, or off), Select Cases (a filter that leaves the other cases out of analyses: COMPUTE filter_$ = (condition). and FILTER BY filter_$.; SELECT IF, which deletes them; or all cases again with FILTER OFF. and USE ALL.), Weight Cases, Aggregate (into every case, a new dataset of one case per group, or a file), Merge Files with Add Cases and Add Variables (with keys, or a lookup table), Sort Variables (SORT VARIABLES by name, type, format, label, value labels, missing values, measure, role, columns or alignment, ascending or descending) and Restructure: variables to cases (VARSTOCASES with one or more new variables each made from a list of variables, an index variable, a case number variable and the variables to copy), cases to variables (CASESTOVARS with identifier and index variables, the new variables in order of the variable or of the index, sorting the cases first) or transposing cases and variables (FLIP of chosen or all variables, the new variables named by the values of a variable).
  • Analyze: Descriptive Statistics (Frequencies with statistics, the order of the rows, a limit on the values of a table, quartiles, cut points for equal groups and any percentiles, Descriptives, Explore with descriptives, M-estimators, extreme values, percentiles and tests of normality by factor, and Crosstabs), Custom Tables (rows, columns and layers of variables and multiple response sets, means, percentages, totals, significance tests with their letters in a separate table or in the main table, hiding small counts, an effective base weight with the effective count, and per variable the order of the categories, sorted by value, label, count or a mean, the total with its label and position, subtotals over chosen categories that can hide them, and missing and other categories), Compare Means (Means with every cell statistic including the grouped median and percentages within a control variable, the one-sample, independent-samples and paired-samples t tests, One-Way ANOVA with every post hoc test the engine has, Dunnett’s against the first or last group on either side), General Linear Model, Univariate (UNIANOVA of one dependent variable by fixed factors with covariates: the full factorial model or a custom one of main effects and interactions picked from the factors and covariates, the type of sums of squares and the intercept; post hoc tests of chosen factors, the same tests as One-Way ANOVA; estimated marginal means overall and for each chosen factor, with main effects compared unadjusted or by Bonferroni or Sidak; saving predicted values, their standard errors, residuals, Cook’s distance and leverage; descriptive statistics, effect sizes, observed power, parameter estimates, homogeneity tests and the significance level), General Linear Model, Repeated Measures (GLM with WSFACTOR: within-subjects factors each with a name and its number of levels, one variable for each combination of levels, between-subjects factors and covariates, the type of sums of squares, descriptive statistics, effect sizes, observed power and the significance level; one measure only, since MEASURE is not supported yet), Correlate, Bivariate (Pearson by CORRELATIONS, Spearman and Kendall by NONPAR CORR, both commands when both kinds are chosen), Correlate, Partial (PARTIAL CORR of the variables controlling for others, a one- or two-tailed test, the coefficients alone marked with stars, means and standard deviations, the zero-order correlations, and cases left out of every correlation or only where they are missing), Regression, Linear (REGRESSION of one dependent variable on blocks of independent variables, each block with its method: Enter, Stepwise, Remove, Backward or Forward; estimates, confidence intervals at any level, model fit, R squared change, descriptives, part and partial correlations and collinearity diagnostics; saving predicted values, residuals, distances and influence statistics; the stepping criteria as probabilities or values of F, the constant, and listwise, pairwise or mean substitution of missing values), Regression, Binary Logistic (LOGISTIC REGRESSION of one dependent variable with two values on blocks of covariates, each block entered or stepped forward or backward by the conditional, likelihood-ratio or Wald statistic; categorical covariates each with its contrast and the first or last category as reference; saving predicted probabilities, group membership, residuals and influence statistics; the Hosmer-Lemeshow test, confidence intervals for exp(B), the iteration history, the classification cutoff, the stepwise entry and removal probabilities, the maximum iterations and the constant), Classify, K-Means Cluster (QUICK CLUSTER into a number of clusters by iterating and classifying or by classifying only, with the maximum iterations and the convergence criterion; saving the cluster membership and the distance from the cluster center; the initial centers, the ANOVA table and the cluster of each case labelled by a variable; and cases left out listwise or pairwise), Classify, Hierarchical Cluster (CLUSTER of the cases by the variables, labelled by a variable: between-groups or within-groups linkage, nearest or furthest neighbor, centroid or median clustering or Ward’s method; the measure for interval data (squared Euclidean, Euclidean, cosine, Pearson correlation, Chebychev, block, Minkowski with its power, or customized with a power and a root), for counts (chi-squared or phi-squared) or for binary data (squared Euclidean, Euclidean, simple matching, Jaccard, Dice, Russell and Rao, Rogers and Tanimoto, Hamann, Ochiai, phi 4-point correlation or Yule’s Q, with the values of presence and absence; the other binary measures are in the syntax); the agglomeration schedule, the proximity matrix and the cluster membership of one solution or a range of them; and saving the membership of one solution or a range), Classify, Discriminant (DISCRIMINANT of a grouping variable with its range of values by independents entered together or stepwise by Wilks’ lambda, the Mahalanobis distance, the smallest F ratio, the unexplained variance or Rao’s V, with values of F or their probabilities to enter and remove; means, univariate ANOVAs, Box’s M, Fisher’s and unstandardized function coefficients, the within-groups correlation and covariance and the separate-groups and total covariance matrices; prior probabilities equal or from the group sizes, classification by the within-groups or separate-groups covariance, the summary table and leave-one-out classification; saving the predicted group, the discriminant scores and the probabilities of group membership; and a selection variable with its value), Classify, Tree (TREE by CHAID or exhaustive CHAID: a nominal or ordinal dependent, predictors each with its own level or the measure of the dictionary, the maximum depth and the fewest cases in a parent and a child node, target categories for the gain tables, and saving the terminal node, the predicted category and the predicted probabilities), Dimension Reduction, Factor (FACTOR: univariate descriptives, the initial solution, the correlation coefficients with their significance, the determinant, KMO and Bartlett’s test, the inverse, reproduced and anti-image matrices; extraction by principal components, unweighted or generalized least squares, maximum likelihood, principal axis, alpha or image factoring, of the factors with eigenvalues over a value or a fixed number of them, with the maximum iterations; rotation by varimax, direct oblimin with its delta, quartimax, equamax or promax with its kappa, or none; factor scores saved by the regression, Bartlett or Anderson-Rubin method and the score coefficient matrix; listwise, pairwise or mean substitution of missing values, and loadings sorted by size with small ones left blank), Scale, Reliability Analysis (RELIABILITY of one scale of all the items: the Alpha, Split-half, Guttman, Parallel or Strict parallel model, a scale label, descriptives for each item, the scale and the scale if an item is deleted, inter-item correlations and covariances, their summaries, an ANOVA table with the F test, Friedman’s or Cochran’s chi-square, Hotelling’s T-squared, Tukey’s test of additivity, and the intraclass correlation with its model, type, confidence level and test value), Nonparametric Tests (NPAR TESTS from the dialogs analysts know: Chi-square with the categories from the data or a range and equal or given expected values, Binomial with a test proportion and the two values of the data or a cut point, Runs at the median, mode, mean or a custom cut point, 1-Sample K-S against the normal, uniform, Poisson or exponential distribution, 2 Independent Samples with Mann-Whitney, Kolmogorov-Smirnov, Moses and Wald-Wolfowitz, K Independent Samples with Kruskal-Wallis, the median test and Jonckheere-Terpstra, 2 Related Samples with Wilcoxon, sign, McNemar and marginal homogeneity on pairs, and K Related Samples with Friedman, Kendall’s W and Cochran’s Q; each with descriptives, quartiles and cases left out test by test or listwise) and Multiple Response, Frequencies and Crosstabs (MULT RESPONSE: groups defined in the dialog as dichotomies with a counted value or categories with a range, kept from one of the two dialogs to the other while the window is open; frequency tables of every group; crosstabulations of groups and variables in rows, columns and layers, each variable with its range, starting from its lowest and highest labelled value, with row, column and total percentages based on cases or responses; and leaving out cases missing on any variable of a dichotomy or category group).
  • Transform: Compute, Recode, Count Values within Cases, Rank Cases (every RANK function with new names or the default ones, ranks within groups, from the smallest or the largest value, ties, the proportion formula, user-missing values) and Automatic Recode (AUTORECODE into new variables, from the largest value, one scheme for all, blank strings as missing, a table of the values).

Every dialog that builds syntax, the menus’ dialogs and the Variable View’s editors of the type and format, value labels and missing values alike, ends the same way: the syntax it builds (or why it has none yet), then OK, which runs it, Paste, which puts it in the syntax editor, and Cancel; the menus’ dialogs also have Reset. OK and Paste stay off until the syntax is complete, and Escape cancels. Options left at their defaults add nothing to the syntax. Warnings of a run appear under its command in the log, and the status bar says how many there were; a click there shows the log (from the Data or Variable View, in the Syntax view). Errors show in the status bar, whatever the view. At its right the status bar names the split, filter and weight in force, such as Split by region (layered), Filter: filter_$ and Weight: weight; a click on one opens Split File, Select Cases or Weight Cases.

Syntax is the only command layer: every change and every result in the window comes from syntax run by the engine, exactly as statscraft run runs it. Opening a file runs GET FILE, editing a cell runs IF ($CASENUM = n) var = value., editing a label runs VARIABLE LABELS, and so on. The log under the Syntax and Output views (Edit, Settings, Grids and output turns it off; the Data and Variable Views give the grid the whole height) lists every command with what it changed, and Copy syntax there gives a script that repeats the session. Macros defined by one Run (DEFINE, or INCLUDE of a macro library) stay defined for the later ones while the window is open, with the macro settings of SET.

Edit, Settings holds every setting of the window in one dialog, with its sections in a list on the left. A change applies at once and is saved; Close or Escape closes the dialog. Grids and output also chooses how tables show variables (labels, names, or names and labels) and values (labels, values, or values and labels): these belong to the session, not the window, so a choice runs SET TVARS or SET TNUMBERS like any other command, shows in the log and stays for the later runs; a SET in syntax changes the dialog too. The window also keeps the choice (the lines tvars names and tnumbers both in window.txt) and runs the same SET when it starts, so it is set once.

  • Editor: Syntax colours, the colours and background of the syntax editor, from Statscraft Light (the default) and Dark, in the Statscraft colours, and ready-made editor themes: Catppuccin Latte and Mocha, One Dark, Solarized Light and Dark, GitHub Light and Dark. Wrap long lines (on by default) wraps them at the window edge.
  • Grids and output: the paper of the Data and Variable grids and the output tables. Always light (the default) keeps them dark text on a light sheet while menus, panels and dialogs follow the system’s dark or light theme, as a spreadsheet or a document page does; Follow the system theme draws them in the system theme too. Log under Syntax and Output (on by default); a run with warnings shows the log even when it is off.
  • Updates: Check for updates automatically (see Updates below).

Help, Documentation opens these pages online; Help, About shows the version, the license (MIT), links to the source code and the documentation, where the colour themes come from with their licenses, and the licenses of the fonts.

The window remembers its size and position, the folder of the last file dialog, the ten files opened or saved last (File, Recent files), the settings of Edit, Settings and the Variable View’s column widths in statscraft/window.txt in the user’s config folder: %APPDATA% on Windows, $XDG_CONFIG_HOME or ~/.config elsewhere.

Edit, Undo last change (Ctrl+Z outside a text field) puts back the dataset from before the last run that changed it, one step; the log marks that run as undone and Copy syntax leaves it out.

Closing the window (the title bar, Alt+F4, File, Exit, the Windows installer of an update, or Restart now) first checks for unsaved work: data changed since it was last opened or saved, and syntax whose text differs from its file, or new syntax that is not empty. With nothing unsaved the window closes at once. Otherwise one question lists what is unsaved, with Save, Don’t save and Cancel. Save saves the syntax and the data, each to its file, or with a file dialog when there is none yet, and closes the window once both are written; a cancelled file dialog or a failed save keeps the window open. Cancel, Escape or a click beside the question keeps the window open. Data counts as saved after a run that ends with GET, GET DATA or SAVE, whether from a menu, the syntax editor or the command line. New syntax, Open syntax, a syntax file from Recent files or one dropped on the window ask the same question when the syntax in the editor is unsaved: Save saves it first, Don’t save drops it, Cancel keeps it.

Opening a file and every run happen off the drawing thread: the status bar shows what is running and the window stays responsive. One run goes at a time; requests from the command line wait their turn.

Updates

The window asks GitHub at most once a day, in the background and never holding up the start, whether a newer release is published. Checks are on by default and say nothing unless a newer version is out. Edit, Settings, Updates turns them on and off (the line updates on or updates off in window.txt), and Help, Check for updates checks at once and also says when there is nothing new.

When a newer release is out, a small bar under the menu says so, with a link to the release notes, Update now and Later. Later hides the bar until the next check. Update now downloads the package for this installation, checks it against the release’s SHA256SUMS and then:

  • installed with the Windows installer: closes the window, runs the new installer silently for the same per-user installation (same folder, file types and Start menu entry) and the installer opens the window again. Unsaved work is asked about first, as for any close.
  • installed from the tarball: replaces statscraft and statscraft-gui in its bin folder (each written next to the old one, then renamed over it) and offers Restart now, which closes the window (asking about unsaved work first) and then starts the new one; Cancel keeps this window and starts none.
  • unpacked from the portable Windows .zip (the folder with LICENSE.txt next to the programs): replaces statscraft.exe and statscraft-gui.exe in that folder the same way and offers Restart now. Windows cannot replace a running program, so the old one is renamed aside first and deleted the next time Statscraft starts.
  • Statscraft.app on macOS: there is no Update now but a Download link to the new macOS package; replace Statscraft.app with the one in it. The updater does not change files inside the app, which a signed app would not allow.
  • installed from the .deb: saves the package in ~/Downloads and shows the one command that installs it, sudo apt install ~/Downloads/statscraft_X_amd64.deb, with a button that copies it. The window never runs sudo.
  • built from source or copied elsewhere: there is no Update now; the bar says to install the new version the way this copy was installed.

The check is one request to the GitHub API with the User-Agent statscraft/VERSION; nothing about you or your data is sent. statscraft update does the same from the command line.

Driving the window from the command line or an AI agent

While the window is open it is a live session named gui:

statscraft run -s gui -e "GET FILE='survey.sav'."         the window opens the file
statscraft run -s gui --json job.sps                      runs job.sps in the window
statscraft check -s gui -e "COMPUTE x = age / 10."       validates against the window's data
statscraft describe -s gui --json                        dictionary of the window's dataset

The window runs the syntax exactly as its own Run button does: the tables appear in Output, the commands in the log, and the data grid shows the result. The command line prints what it prints for a file session, with "session": "gui"; saved is true when the run changed the window’s dataset (nothing is written to disk unless the syntax says SAVE). Relative paths in the syntax are read from the folder where statscraft was started, and the window stays in that folder.

So an AI agent with a shell can work in the open window: start statscraft-gui, then tell the agent to use statscraft run -s gui --json for every step and statscraft help COMMAND for the syntax. The person watching sees each table appear and can keep working in the window between the agent’s runs.

How it connects: on start the window listens on a random TCP port of 127.0.0.1 and writes the address and a random token to statscraft/gui.json in $XDG_RUNTIME_DIR on Linux or %LOCALAPPDATA% on Windows (~/.config otherwise), readable only by the user. A request without the token is refused, and the command line sends the token only to a local address. When no window is open, -s gui fails with “no Statscraft window is running”. With several windows open, the one started last answers.

The window brings its own fonts: Schibsted Grotesk for menus, dialogs, grids and output, with digits of equal width so numbers line up in columns, and JetBrains Mono for syntax. Both are under the SIL Open Font License. Characters they lack, such as Cyrillic in Schibsted Grotesk, come from system fonts (Segoe UI and Consolas on Windows, DejaVu, Noto or Liberation on Linux). Set STATSCRAFT_FONT or STATSCRAFT_MONO_FONT to a .ttf file to use another font first.

Statscraft 0.7.0, release v0.7.0

The command line

statscraft describe   dictionary and counts of a data file or a session
statscraft run        run syntax
statscraft check      validate syntax without saving or writing anything
statscraft help       syntax of a command, or the list of commands
statscraft plan       lower syntax to an OpenStatSpec transformation plan
statscraft db         store datasets in an OpenStatSpec SQLite database and read them back
statscraft update     check for a newer release, or update this installation to it

statscraft --version prints the version, and statscraft <subcommand> --help lists the flags of a subcommand. The examples run from the root of the repository and use the synthetic files in tests/fixtures/; job.sps is the file from Getting started.

describe

statscraft describe FILE [--json]
statscraft describe -s SESSION [--json]
FlagMeaning
FILEa .sav or .zsav file
-s, --session NAMEdescribe a session instead: its dataset and the state it keeps; gui is the open window
--jsonthe full dictionary as JSON instead of one line per variable

Give either a file or a session. The text form prints cases, variables and then, per variable, name, format, measurement level, valid count and label, separated by tabs. For a session it goes on with what the session keeps besides the data, one line each when there is something: settings:, PRESERVE levels:, directory:, active dataset:, other datasets:, macros:. In JSON these are the object session (see Sessions).

run

statscraft run [FILE | - | -e TEXT] [-s SESSION] [--lines FIRST-LAST] [--json] [--encoding NAME] [--xlsx FILE [--xlsx-one-sheet]]
FlagMeaning
FILEa syntax file; - reads the syntax from standard input
-e, --execute TEXTsyntax given on the command line instead of a file
-s, --session NAMEload the dataset from this session before the run and save it after; gui is the open window
--lines FIRST-LASTrun only the commands inside these lines (1-based, inclusive), for example 40-55
--jsonprint the result as JSON instead of Markdown
--encoding NAMEencoding of the syntax file or standard input, such as windows-1257 or 1252; without it a file that is valid UTF-8 (with or without a byte order mark) is read as UTF-8 and any other file in the system’s legacy code page
--xlsx FILEalso write every table of the run to an Excel workbook, one sheet per table
--xlsx-one-sheetwith --xlsx, put all tables on one sheet, one below the other

Without --json, every table is printed as a Markdown table under a ### title, warnings as warning: line N: COMMAND: message, then a summary: the dataset loaded, variables added, changed and removed, the case count when it changed, and ran N command(s), with , session saved when the session was written.

statscraft run job.sps
statscraft run -s demo -e "FREQUENCIES VARIABLES=gender."
echo "DESCRIPTIVES VARIABLES=age monthly_spend." | statscraft run -s demo -

A run is all or nothing. When any command fails, nothing is saved: not the session, not the workbook. Files that SAVE wrote before the failing command stay on disk.

check

statscraft check [FILE | - | -e TEXT] [-s SESSION] [--lines FIRST-LAST] [--json] [--encoding NAME]

The same flags as run, without --xlsx. check runs the commands on a copy of the session’s dataset and skips every file write, so it finds both syntax errors and errors that depend on the data (an unknown variable, a string where a number is needed). The session and the disk stay unchanged. The summary says checked N command(s), and in JSON saved is always false.

statscraft check -s demo -e "COMPUTE age10 = age / 10."
variables added: age10
checked 1 command(s)

Every syntax error of the source is reported at once, one per bad command. Errors found while running stop at the first failing command.

help

statscraft help                     the supported commands with one line each, then the general rules
statscraft help FREQUENCIES         syntax, notes and an example of one command
statscraft help freq                names may be lowercase and shortened, as in syntax

A command of the language that Statscraft does not run yet (for example statscraft help LIST) gets “is a command of the language, but it is not supported yet”. An unknown name is an error. The same text, one page per command, is in commands.

Sessions and line ranges

A session is what one window would keep from one run to the next, stored on disk in .statscraft/sessions/<name>/ under the current folder. A name may hold letters, digits, - and _.

WhatKeptWhere in the session folder
The active dataset: data, dictionary, weight, file label, documents, attributes, multiple response setsyesdata.zsav
SPLIT FILE and FILTER of the active datasetyesstate.json
Where the random number generators stand (SAMPLE, UNIFORM, NORMAL, RV functions), so the next run goes on where the last one stoppedyesstate.json
Named datasets (DATASET NAME, COPY, DECLARE) and which one is active, each with its split and filteryesdatasets/
Macros (DEFINE) and the macro settings MEXPAND, MPRINT, MNEST, MITERATEyesmacros.sps
File handles (FILE HANDLE), SET values, PRESERVE levels not yet restored, the CD folderyessettings.sps, as FILE HANDLE, SET, PRESERVE and CD commands
TEMPORARY, N OF CASES, scratch variables, VECTORno: the end of a run is a data pass, so they take effect or end in the run that gives them
An open DO IF, LOOP, or a DATA LIST without its BEGIN DATAno: the run fails
The folder of the syntax file, where INSERT and INCLUDE startno: each run starts from its own file
  • The first run of a new session starts without data; its syntax usually begins with GET FILE. Settings, macros and a CD may come before any data.
  • With --lines, only the macros defined on those lines are kept; a macro defined elsewhere in the file still serves the run, as before.
  • A run saves the session when it changed anything in the table above, or when the session file did not exist yet. A failed run keeps none of its changes. A dataset keeps the encoding of the file it came from; when a label or value no longer fits that code page (a letter of another language), the session keeps it in UTF-8 instead.
  • describe -s NAME shows the active dataset and, under session in the JSON, the SET values given, the number of PRESERVE levels, the CD folder, the active dataset’s name, the other named datasets and the macros.
  • check and describe never write it.
  • Delete the session’s folder to start over.
statscraft run -s demo --lines 1-1 job.sps
statscraft run -s demo --lines 4-6 job.sps

--lines selects the commands that lie inside the range. Blank lines and comments inside it are fine, and a syntax error on a line outside the range does not stop it, but the range must cover whole commands. A range that cuts through one fails:

error: line 1, column 1: line range 2-3 cuts through command FREQUENCIES, which occupies lines 1-2; hint: use lines 1-3 to include the whole command

Line numbers in the output always refer to the whole file, not to the range.

JSON output

run, check and describe print pretty JSON with --json. plan and db always print one line of JSON.

Run result

statscraft run -s demo --json -e "COMPUTE spend_year = monthly_spend * 12. followed by a second line FREQUENCIES VARIABLES=gender." prints (the table rows are shortened here):

{
  "ok": true,
  "session": "demo",
  "commands": [
    {
      "name": "COMPUTE",
      "first_line": 1,
      "last_line": 1,
      "tables": [],
      "warnings": []
    },
    {
      "name": "FREQUENCIES",
      "first_line": 2,
      "last_line": 2,
      "tables": [
        {
          "title": "gender: Gender",
          "row_headers": 3,
          "columns": ["Category", "Value", "Label", "Frequency", "Percent", "Valid Percent", "Cumulative Percent"],
          "column_groups": [[], [], [], [], [], [], []],
          "rows": [
            ["valid", 1.0, "Male", 106.0, 53.0, 53.0, 53.0],
            ["total", null, null, 200.0, 100.0, null, null]
          ]
        }
      ],
      "warnings": []
    }
  ],
  "changes": {
    "cases_before": 200,
    "cases_after": 200,
    "variables_added": ["spend_year"],
    "variables_removed": [],
    "variables_changed": []
  },
  "dataset": [200, 21],
  "saved": true
}
FieldMeaning
oktrue
sessionthe session name; absent without -s
commandsone entry per command that ran, in order, with its first and last line in the source
commands[].tablesthe tables of that command
commands[].warningswhat the command did differently from what was asked, without failing, for example "no statistics for string variables: plan"
changesthe case count before and after (null when there was no dataset), and the names of variables added, removed and changed. A variable counts as changed when its dictionary entry or any value differs
dataset[cases, variables] of the active dataset after the run; absent when there is none
savedtrue when the session file was written (for gui: when the run changed the window’s session). Always false without a session and for check

A table:

FieldMeaning
titlethe table title
row_headershow many leading columns are row labels
columnsthe innermost header of each column
column_groupsfor each column, the header levels above it, outermost first; empty lists for a one-level header
rowsthe cells: a number, a text or null for an empty cell. Numbers are raw, not rounded
formatsoptional, in the shape of rows: the display format of each cell, such as "PCT5.1", or ""
captionoptional text under the table

A custom table with two header levels, from CTABLES /TABLE region [COUNT, COLPCT.COUNT PCT5.1] BY gender. (first row only, shortened):

{
  "title": "Custom Tables",
  "row_headers": 2,
  "columns": ["", "", "Count", "Column %", "Count", "Column %", "Count", "Column %"],
  "column_groups": [["", ""], ["", ""], ["Gender", "Male"], ["Gender", "Male"], ["Gender", "Female"], ...],
  "rows": [["Region of residence", "North", 23.0, 21.69811320754717, 11.0, 12.5, 0.0, 0.0], ...],
  "formats": [["", "", "F40.0", "PCT5.1", "F40.0", "PCT5.1", "F40.0", "PCT5.1"], ...]
}

Error

On any failure --json prints this on standard output, and the exit code is 1:

{"ok":false,"errors":[{"kind":"syntax","message":"unexpected end of command","line":1,"column":18,"expected":["a value","a variable","a function","'('"]}],"saved":false}
FieldMeaning
kindsyntax (the text cannot be parsed), run (a command failed on the data), usage (wrong flags or arguments), session or file (reading or writing failed)
messagewhat went wrong
line, columnwhere, 1-based. Syntax errors have both; run errors have the first line of the command
commandfor run errors, the command that failed
expectedfor syntax errors, what would have been valid at that point
hinta suggestion, such as "did you mean FREQUENCIES?"

More examples:

{"ok":false,"errors":[{"kind":"run","message":"unknown variable agee","command":"FREQUENCIES","line":2}],"saved":false}
{"ok":false,"errors":[{"kind":"syntax","message":"unknown command FREQUENCIS","line":1,"column":1,"hint":"did you mean FREQUENCIES?"}],"saved":false}

Without --json the same errors go to standard error as error: line 1, column 18: unexpected end of command; expected: a value, a variable, a function, '('.

Warnings

Warnings do not fail a run. They are in commands[].warnings of the run result, and in text output as:

warning: line 1: DESCRIPTIVES: no statistics for string variables: plan

describe

statscraft describe tests/fixtures/survey_basic_phpwriter.sav --json (shortened):

{
  "encoding": "UTF-8",
  "compression": "bytecode",
  "case_count": 200,
  "variable_count": 19,
  "file_label": "Statscraft synthetic customer survey",
  "weight_variable": "weight",
  "multiple_response_sets": [
    {"name": "$q5", "type": "dichotomy", "label": "Q5. Contact channels used", "counted_value": 1,
     "variables": ["q5_1", "q5_2", "q5_3", "q5_4", "q5_5"]},
    {"name": "$q6", "type": "category", "label": "Q6. Other providers mentioned", "counted_value": null,
     "variables": ["q6_mention1", "q6_mention2", "q6_mention3"]}
  ],
  "variables": [
    {
      "name": "q2_recommend",
      "type": "numeric",
      "label": "Q2. How likely are you to recommend us to a friend or colleague?",
      "format": "F2.0",
      "measure": "scale",
      "value_labels": {"0": "Not at all likely", "10": "Extremely likely", "97": "Not applicable", "98": "Don't know", "99": "Refused"},
      "missing_values": [],
      "missing_range": [97.0, 99.0],
      "n_valid": 176,
      "n_system_missing": 0,
      "n_user_missing": 24
    },
    {
      "name": "plan",
      "type": "string",
      "width": 10,
      "label": "Current subscription plan",
      "format": "A10",
      "measure": "nominal",
      "value_labels": {},
      "missing_values": [],
      "missing_range": null,
      "n_valid": 200,
      "n_system_missing": 0,
      "n_user_missing": 0
    }
  ]
}
FieldMeaning
encoding, compressionof the file (none, bytecode or zlib)
file_labelabsent when the file has none
weight_variablethe weight variable, or null
multiple_response_setsabsent when there are none
variables[].typenumeric or string; strings also have width in bytes
variables[].measurenominal, ordinal, scale or unknown
variables[].value_labelsvalue (as text) to label
variables[].missing_values, missing_rangethe user-missing values: up to three values, or a [low, high] range
n_valid, n_system_missing, n_user_missingcounts over all cases

Exit codes

CodeWhen
0success, including runs with warnings
1the syntax, the run, a file or a session failed; also plan and db when they print "ok":false
2the command line itself is wrong: an unknown flag, a missing value, flags that conflict
10update --check: a newer release is published

update

statscraft update --check          current and latest version; exit code 10 when an update exists
statscraft update --check --json   the same as JSON
statscraft update                  update this installation to the latest release

The latest release is the newest published release on the GitHub repository; drafts and prereleases do not count. update --check prints the running and the latest version and exits with 0 when this copy is up to date (also when no release is published yet) and with 10 when a newer one exists, so a script can ask statscraft update --check || .... With --json it prints one line:

{"current":"0.1.0","latest":"0.2.0","update":true,"notes":"https://github.com/statscrafthq/statscraft/releases/tag/v0.2.0"}

latest is null when no release is published yet, and notes is the release page when there is an update.

update does what the window’s Update now does, for the way this copy was installed:

Installed withWhat update does
the Windows installerdownloads the new installer and starts it silently for the same per-user installation; it closes an open window first
the portable Windows .zip, with LICENSE.txt next to the programsdownloads the .zip and replaces statscraft.exe and statscraft-gui.exe in that folder; the old ones are renamed aside and deleted on a later start
the tarball, under a prefix such as ~/.localdownloads the tarball and replaces statscraft and statscraft-gui in its bin folder
the .debdownloads the package into ~/Downloads and prints the one command that installs it, sudo apt install ~/Downloads/statscraft_X_amd64.deb; it never runs sudo itself
anything else (a build from source, a copy elsewhere, the command line from the macOS package)refuses with exit code 1, says to update it the way it was installed and gives the release page

Every download is checked against the SHA256SUMS file of the release before anything is run or replaced; on a mismatch nothing changes and the file is deleted. The installer, the tarball and the .zip go to a temporary folder that is removed after use. Errors print as for the other subcommands, exit code 1.

The only requests go to GitHub over HTTPS: one to the API for the latest release and, on update, the download of SHA256SUMS and of the one package. They carry the User-Agent statscraft/VERSION and nothing else about you; there is no account, token or telemetry.

Excel export

statscraft run job.sps --xlsx tables.xlsx
statscraft run job.sps --xlsx all.xlsx --xlsx-one-sheet
statscraft run -s gui -e "FREQUENCIES VARIABLES=gender." --xlsx gender.xlsx

Every table of the run goes into the workbook, with or without a session, and also from the window session. With one sheet per table the sheet is named after the table title (gender Gender, region Region of residence, …); with --xlsx-one-sheet there is one sheet Tables with the tables one below the other.

Each table has its title in bold, the column headers with merged cells for every level, the row labels, thin borders and its caption below. Numbers stay numbers, with a number format that shows them as the output does: a percentage cell holds 45.2 and shows 45.2%. Text such as significance letters and hidden small counts (<5) stays text. The text output on the terminal is the same as without --xlsx.

A workbook that cannot be written fails the run, and the session is then not saved.

The live window session

While statscraft-gui is open, the session name gui means the window:

statscraft run -s gui -e "GET FILE='tests/fixtures/survey_basic.sav'."
statscraft run -s gui --json job.sps
statscraft check -s gui -e "COMPUTE x = age / 10."
statscraft describe -s gui --json
  • The window runs the syntax as its own Run button does: the tables appear in Output, the commands in the log, the grid shows the new data.
  • The command line prints what it prints for a file session, with "session": "gui". saved is true when the run changed the window’s session (the table under Sessions); nothing is written to disk unless the syntax says SAVE.
  • The window keeps the same state between runs as a file session, in memory until it closes; describe -s gui shows it the same way.
  • Relative paths in the syntax are read from the folder where statscraft was started, and the window stays in that folder.
  • One run goes at a time. A request waits while the window is busy.
  • When no window is open, -s gui fails with “no Statscraft window is running”. With several windows open, the one started last answers.

How it connects, and why it is safe: see AI agents.

plan

statscraft plan [FILE | - | -e TEXT] (--input-schema FILE | -s SESSION | --sqlite DB --name DATASET [--apply [--actor NAME]])
                [--profile 0.1|0.2|0.3] [--alias NAME]

plan turns a bounded part of the language into an OpenStatSpec Transformation Plan: one line of canonical JSON with the plan, its SHA-256 plan_hash and the source_hash of the syntax, or an error with a stable code, line and column.

FlagMeaning
--input-schema FILEJSON of the form {"variables": [{"name": "q1", "storage_kind": "numeric"}]}
-s, --session NAMEtake the input schema from a session’s dataset
--sqlite DB --name DATASETtake it from a dataset in an OpenStatSpec SQLite database
--applywith --sqlite, apply the plan to that dataset in place, in one transaction with one audit row
--actor NAMEwho applies the plan, for the audit row; default $USER
--profilethe frontend profile, 0.3 by default
--aliasthe name of the input dataset in the plan, input by default

Profile 0.1 accepts RECODE, VARIABLE LABELS and VALUE LABELS; 0.2 adds COMPUTE and IF with single values and simple comparisons, FORMATS, VARIABLE LEVEL and EXECUTE; 0.3 adds comments, TO lists, NE and NOT, LOWEST and HIGHEST ranges and ADD VALUE LABELS. Everything else is rejected, even where run accepts it. With schema.json holding {"variables": [{"name": "q1", "storage_kind": "numeric"}, {"name": "q2", "storage_kind": "numeric"}]}:

statscraft plan -e "RECODE q1 (1 = 0)." --input-schema schema.json --profile 0.1
statscraft plan -s demo -e "RECODE q1_satisfaction (98, 99 = SYSMIS)."
statscraft plan -e "FREQUENCIES q1." --input-schema schema.json

The last one prints {"error":{...,"message":"FREQUENCIES is not supported by frontend profile 0.3",...},"ok":false,...}, whose code is the profile’s code for an unsupported command, and exits with 1.

db

statscraft db export (FILE | -s SESSION) --sqlite DB [--name NAME]
statscraft db import --sqlite DB --name NAME (--out FILE | -s SESSION) [--allow-loss]

db stores a dataset in an SQLite database laid out as OpenStatSpec specifies: one table data_<name> with __case_ordinal and one column per variable, and the dictionary in catalog tables. The database file belongs to OpenStatSpec: export sets up the catalog in a new or empty file and refuses a file that holds anything else.

statscraft db export tests/fixtures/survey_basic.sav --sqlite study.db
statscraft db export -s demo --sqlite study.db --name work
statscraft plan -e "RECODE q1_satisfaction (98, 99 = SYSMIS)." --sqlite study.db --name survey_basic --apply --actor demo
statscraft db import --sqlite study.db --name survey_basic --out back.sav
statscraft db import --sqlite study.db --name work -s fromdb

Each prints one line of JSON, such as {"case_count":200,"dataset":"survey_basic","dataset_id":"...","ok":true,"table":"data_survey_basic","variable_count":19}, or {"ok":false,"error":{"code":...,"message":...}} with exit code 1.

FlagMeaning
--namethe dataset name: ASCII letters, digits and _. For export it defaults to the file or session name
--out FILEimport writes this .sav or .zsav file
-s, --session NAMEexport reads, or import replaces, this session’s dataset
--allow-lossimport goes on when the catalog holds items a dataset cannot keep (dataset attributes, variable sets, write formats that differ from the print format)

Before writing, export checks the column limit (2000 including __case_ordinal), identifiers and value sizes, and refuses NaN and negative zero, which SQLite cannot keep. A failure leaves no table and no dataset row behind.

Databases other than SQLite

statscraft db export survey.sav --sqlite study.db [--name survey]   store a dataset in SQLite
statscraft db export survey.sav --postgres URL                      or in PostgreSQL
statscraft db export survey.sav --mysql URL                         or in MySQL or MariaDB
statscraft db export survey.sav --dolt URL                          or in Dolt
statscraft db capabilities                                          versions and limits per database
statscraft db export -s work --sqlite study.db --name work          store a session's dataset
statscraft db import --sqlite study.db --name survey --out back.sav read it back into a file
statscraft db import --sqlite study.db --name survey -s work        or into a session
statscraft plan job.sps --sqlite study.db --name survey --apply     apply syntax to it in place

db stores a dataset the way OpenStatSpec’s SAV/ZSAV profile 1.0 and its SQL dialect profiles specify: one table data_<name> with __case_ordinal (1, 2, 3, … in case order) and one column per variable in variable order, numbers as binary64 with system-missing as NULL, strings as text that is never NULL, user-missing codes kept as values, dates as numbers. The dictionary (labels, value labels, missing values, formats, measurement level, role, display settings, attributes, documents, weight variable, multiple response sets) goes into the catalog tables. The database belongs to OpenStatSpec: export sets up the catalog in a new or empty one and refuses one that holds anything else. Before writing, a preflight checks the column limit, identifiers, value sizes and the row size against the profile and the server’s settings. A failure leaves no table and no dataset row, only the failed operation and its diagnostic. The rows go in bulk inside the same transaction: PostgreSQL takes them with COPY in the binary format, MySQL and MariaDB in prepared multi-row INSERTs of at most 4 MiB, Dolt in multi-row INSERTs of literal values of at most 256 KiB, each within max_allowed_packet, SQLite through one prepared INSERT per case. Reading streams the rows from the server into the dataset instead of holding the whole result first. Variable names that are not plain ASCII get generated column names (v<position>); the catalog maps them back. Reading a dataset whose catalog holds items Statscraft cannot keep (dataset attributes, variable sets, write formats other than the print format) fails unless --allow-loss is given; the losses are then listed in the output.

SQLitePostgreSQLMySQL, MariaDBDolt
Option--sqlite FILE--postgres postgres://user@host:port/db[?schema=NAME]--mysql mysql://user@host:port/db--dolt mysql://user@host:port/db
The catalog lives inthe whole fileschema NAME (default openstatspec)database dbdatabase db, on the session’s branch
Server versionsbundled SQLite17.x, 18.x, UTF8 encodingMySQL 8.4.x, 9.7.x; MariaDB 11.4.x, 11.8.x, 12.3.x; 16 KiB InnoDB pagesreads 2.2.x from 2.2.2 on; writes 2.2.2 and 2.2.3
Columns, __case_ordinal included2,0001,6001,0174,097
NumbersREAL; NaN and negative zero refusedDOUBLE PRECISION, every bit pattern keptDOUBLE; NaN, infinities and negative zero refusedDOUBLE; NaN, infinities and negative zero refused
TextTEXT NOT NULLTEXT NOT NULL; U+0000 refusedTEXT NOT NULL, binary collation, at most 65,535 bytesLONGTEXT NOT NULL
Rowthe length limita heap tuple of 8,160 bytes (NULLs are free)the InnoDB record of 8,126 bytes: 8 per number, 41 (MySQL) or 21 (MariaDB) per string; one INSERT within max_allowed_packeta table definition below 65,504 bytes: 8 per number, 20 per string
Identifiers255 bytesmax_identifier_length (63 bytes)64 characters64 characters
New variables in plan --applyyes, in the same transactionyes, in the same transactionno: schema_change_not_atomic before any changeno: schema_change_not_atomic

MySQL, MariaDB and Dolt commit DDL implicitly, so export creates the table first, writes the rows and the catalog in one transaction, and drops the table again if that fails. A plan that would create a variable is refused before anything changes; create the column and its catalog variable in a separate step first.

The product is decided by what the server says about itself, not by the protocol: --mysql refuses a Dolt server and --dolt refuses MySQL and MariaDB. On Dolt, Statscraft never commits, branches, merges or resets. db export leaves its changes in the working set for you to commit; db import and the input schema of plan write nothing at all (OpenStatSpec’s Database I/O Execution Policy v1, which db capabilities declares), so allowed losses are reported in the output instead of in the catalog. plan --apply on Dolt needs --expected-branch and --expected-head: the session must be on that branch at that commit with a clean working set, and the branch must still point at that commit when the apply completes; the audit row records both, and the changes stay uncommitted. The session’s branch is the database’s default branch, or the one named as db/branch in the URL.

A URL without a password takes it from the STATSCRAFT_DB_PASSWORD environment variable. Passwords are never printed.

Connections use plain TCP unless the URL asks for TLS. TLS always verifies the server’s certificate chain, against the CA file when one is given and otherwise against the bundled Mozilla root certificates, and also the host name unless the mode says otherwise. Statscraft never makes an unverified TLS connection, and refuses the modes that fall back to plain TCP (prefer, allow, PREFERRED).

statscraft db export survey.sav --postgres "postgres://analyst@db.example.org/study?sslmode=verify-full"
statscraft db export survey.sav --postgres "postgres://analyst@10.0.0.5/study?sslmode=verify-ca&sslrootcert=/etc/ssl/study-ca.pem"
statscraft db export survey.sav --mysql "mysql://analyst@db.example.org/study?ssl-mode=VERIFY_IDENTITY&ssl-ca=/etc/ssl/study-ca.pem"
PostgreSQL sslmodeMySQL, MariaDB, Dolt ssl-modeConnection
not given, disablenot given, DISABLEDplain TCP
verify-full, requireVERIFY_IDENTITY, REQUIREDTLS; the certificate chain and the host name are checked
verify-caVERIFY_CATLS; the certificate chain is checked, the host name is not

sslrootcert=FILE (PostgreSQL) or ssl-ca=FILE (MySQL, MariaDB, Dolt) names a PEM file of the CA certificates to trust, for a server whose certificate comes from a private CA; a CA file without a mode means verify-full. With a CA file, PostgreSQL trusts only that file; the MySQL client trusts the bundled roots as well. Note that require and REQUIRED check more than in the PostgreSQL and MySQL command line clients, where they encrypt without checking the certificate.

plan --name DATASET with a database option takes the input schema from that dataset; with --apply it then applies the plan to the same table in one transaction: direct UPDATEs, ALTER TABLE ... ADD COLUMN for new variables, catalog updates and one audit row in transformation_apply (plan and source hashes, actor, operation count). Nothing is copied, and on any error nothing changes. --actor names who applies the plan (default $USER).

Statscraft 0.7.0, release v0.7.0

Statscraft for AI agents

Statscraft is built so that an AI agent with a shell can do the analysis work: everything is syntax, every result is JSON, every error has a line and a column, and a session keeps the data between steps. This page says how an agent should work, and gives a block of instructions you can paste into your agent.

The loop

  1. Look at the data. statscraft describe FILE --json gives the dictionary: variable names, types, labels, value labels, missing values, valid counts, the weight variable and multiple response sets. Read it before writing syntax, so names and codes are right.
  2. Look up the syntax. statscraft help lists the supported commands; statscraft help COMMAND gives the syntax, the rules and an example. Use only what the help shows. A command that is not supported yet fails with a clear error.
  3. Write syntax to a file (job.sps), one command per line or block, each ending with a period.
  4. Check it. statscraft check -s NAME --json job.sps parses every command and runs it on a copy of the session’s data, so it finds unknown variables and type errors too, and writes nothing.
  5. Run it in pieces. statscraft run -s NAME --json --lines FIRST-LAST job.sps runs the commands in those lines and keeps the result in the session. The next range builds on it. Line numbers stay those of the file. The session keeps what one window would keep between runs: the data with its weight, split and filter, the named datasets, the macros (run the INCLUDE of a macro library once and call its macros in later runs), the file handles, the SET values, PRESERVE levels, the CD folder and where the random numbers stand. TEMPORARY, N OF CASES and scratch variables end with the run that gives them. statscraft describe -s NAME --json shows the kept state under session; the full list is in the command line.
  6. Read the JSON. ok says whether the run worked. changes names the variables added, changed and removed and the case counts before and after; dataset gives the size; commands[].tables holds the results with raw numbers; commands[].warnings says where a command did something other than asked.
  7. Fix errors where they point. On failure errors[] gives kind, message, line and, for syntax errors, column, expected and often a hint. Fix that line and run the same range again. A failed run saves nothing, settings included, so a retry starts from the same state.

A short session:

statscraft describe tests/fixtures/survey_basic.sav --json
statscraft help RECODE
statscraft check -s work --json job.sps
statscraft run -s work --json --lines 1-1 job.sps
statscraft run -s work --json --lines 4-6 job.sps
statscraft run -s work --json -e "FREQUENCIES VARIABLES=age_group."
statscraft describe -s work --json

A syntax error tells the agent where and what:

{"ok":false,"errors":[{"kind":"syntax","message":"unexpected end of command","line":1,"column":18,"expected":["a value","a variable","a function","'('"]}],"saved":false}

A misspelled command comes with a suggestion:

{"ok":false,"errors":[{"kind":"syntax","message":"unknown command FREQUENCIS","line":1,"column":1,"hint":"did you mean FREQUENCIES?"}],"saved":false}

See the command line for every field.

Good habits:

  • Use --json for every step and read the ok field first; the exit code is 0 on success and 1 on failure.
  • Keep the whole analysis in one .sps file and run it by line ranges, so the file is the record of what was done and runs again from the top with statscraft run job.sps.
  • Use a new session name for a fresh start, or delete .statscraft/sessions/NAME/.
  • Numbers in the JSON are raw. Round them only when you report them.
  • Add --xlsx tables.xlsx to a run when the person wants the tables in Excel.

Working in the open window

When the person has statscraft-gui open, the agent can work in it instead of a file session: the session name gui sends the syntax to the window, which runs it like its own Run button. The person sees each table appear in Output and each command in the log, and can keep working in the window between the agent’s runs.

statscraft run -s gui --json -e "GET FILE='tests/fixtures/survey_basic.sav'."
statscraft describe -s gui --json
statscraft check -s gui --json -e "COMPUTE x = age / 10."
statscraft run -s gui --json job.sps

The replies are the same JSON as for a file session, with "session": "gui". Relative paths in the syntax are read from the folder where the agent runs statscraft. When no window is open, the reply is the error “no Statscraft window is running”.

Because the person may also change the data in the window, the agent should run statscraft describe -s gui --json again before it relies on names or counts it saw earlier.

Instructions to paste into your agent

You can analyse data with Statscraft, a statistics program driven by the established
statistics command syntax (COMPUTE, RECODE, FREQUENCIES, CTABLES and so on). Use the `statscraft` command line in the shell.

- Start with `statscraft describe <file> --json` to learn the variables, labels and missing values.
- Look up syntax with `statscraft help` and `statscraft help <COMMAND>`. Use only commands and
  options that the help lists.
- Write the syntax to a .sps file. Before running, check it:
  `statscraft check -s work --json <file>.sps`.
- Run it in steps that keep the data between them:
  `statscraft run -s work --json --lines FIRST-LAST <file>.sps`, or
  `statscraft run -s work --json -e "<syntax>"` for a single command. The session keeps data,
  settings, macros and named datasets between runs; `statscraft describe -s work --json` shows them.
- Read the JSON. If "ok" is false, fix the line and column given in "errors" (use "expected" and
  "hint") and run the same lines again; a failed run changes nothing. Read "warnings" of every
  command and "changes" to confirm what happened to the data.
- If I have the Statscraft window open, use `-s gui` instead of `-s work`, so I see every result.
- Do not write data files unless I ask; nothing is saved to disk without a SAVE command.
- Report numbers from the "tables" in the JSON; do not compute them yourself.

Safety of the live session

The window accepts syntax only from programs of the same user on the same computer:

  • It listens on a random TCP port of 127.0.0.1 only, so other computers cannot reach it.
  • At start it creates a random token and writes the address and the token to statscraft/gui.json in $XDG_RUNTIME_DIR on Linux, %LOCALAPPDATA% on Windows, or ~/.config otherwise. The file is readable only by the user.
  • Every request must carry that token; a request without it is refused. The command line reads the token from the file and sends it only to a loopback address.
  • Requests larger than 64 MB are refused.
  • When the window closes, it removes its file.

What this means in practice: any program running as you can drive the window, just as it could run statscraft itself. Syntax sent to the window can do what syntax can do: read files, and write files with SAVE or AGGREGATE OUTFILE. Treat an agent that can use -s gui like an agent that can run commands in your shell.

Statscraft 0.7.0, release v0.7.0

Differences and limits

Statscraft runs the established statistics command syntax. Its behaviour follows the published reference documentation of that syntax. GNU PSPP, another free program for the same language, is used only to compare numbers. This page lists where Statscraft differs from either on purpose, the choices it made where the documentation says nothing, and what does not work yet.

Where Statscraft follows the documentation and GNU PSPP does not

  • RECODE … INTO an existing variable keeps the old value of a case that no rule matches. A new target variable gets system-missing.
  • Fractional weights are used as they are, not rounded, in counts, percentages and statistics. Only significance tests, confidence intervals, standard errors and T-TEST effect sizes round them, as documented.
  • Zero, negative and missing weights leave the case out of FREQUENCIES, unweighted CTABLES counts and the MEANS minimum and maximum. CORRELATIONS counts a negative weight as 0.
  • DESCRIPTIVES: “Valid N (listwise)” always counts the cases valid on every listed variable. String variables are skipped with a warning. Saved z-scores are named Z plus the variable name, then ZSC001 to ZSC099, STDZ01 to STDZ09, ZZZZ01 to ZZZZ09 and ZQZQ01 to ZQZQ09.
  • CROSSTABS: expected counts in the margins are counts; FORMAT=DVALUE reverses the rows only; /CELLS and /STATISTICS without a list are accepted.
  • CTABLES: an empty count is 0 and EMPTY decides how it shows; the median and percentiles use the averaged empirical distribution; a variable without a measurement level is classed by all the documented rules. With CLABELS ROWLABELS=OPPOSITE the moved categories sit inside the column categories and outside the summary labels.
  • Input programs: after END CASE inside a loop, LEAVE and scratch variables keep their values (GNU PSPP 2.0.1 resets them); a numeric LEAVE variable starts at 0 and keeps its value from case to case (GNU PSPP leaves it system-missing and resets it); NUMERIC gives a new scratch variable 0, as the rules for scratch variables say, so the example that skips the first records works as described (GNU PSPP starts it system-missing); a DATA LIST without variables passes over a record (GNU PSPP refuses it). REPEATING DATA, FILE TYPE and RECORD TYPE are supported.
  • Expressions: 0 ** missing, missing ** 0 and 0 / 0 are missing; MISSING() sees user-missing strings; month 0 in a date is invalid; RND and TRUNC allow for rounding error relative to the size of the value.
  • Expression functions: in CDF, PDF, NCDF, NPDF and SIG a value of x that the distribution does not take gives system-missing (below 0 for CHISQ, outside min to max for UNIFORM, not a whole number in range for the discrete ones), as the manual says; GNU PSPP gives 1 for CDF.BINOM(-1, …), 0 for CDF.LNORMAL of a negative value and reads CDF.BINOM of a fraction. TIME.HMS takes one to three arguments, and minutes or seconds of 60 or more under a larger unit that is not zero, or a fraction before the last argument that is not zero, give system-missing. A .n suffix larger than the number of arguments, as in MEAN.4(a, b), gives system-missing. CHAR.LENGTH leaves out trailing blanks. STRUNC drops a character it would cut. LPAD and RPAD with a missing or invalid length give the null string. MBLEN.BYTE counts the bytes of a UTF-8 character, and NPDF.BETA is the derivative of NCDF.BETA (GNU PSPP 2.0.1 gives 1 and other values). The CHAR. functions, NTRIM, NORMALIZE, the HALFNRM, IGAUSS, SMOD and SRANGE distributions and the noncentral chi-square, F and t are supported.
  • ADD FILES keeps the weight when every file is weighted by the same variable; MATCH FILES and UPDATE keep it when every weighted file uses the same variable (GNU PSPP drops it in all three). When a weighted file leaves the result unweighted, a warning says so. MATCH FILES fails when a TABLE file holds a key twice.
  • ONEWAY: Games-Howell uses separate variances.
  • FREQUENCIES: percentiles and the median use (W + 1) p as documented (PSPP’s default uses another definition, and with weights that are not whole numbers it leaves the formula); NTILES gives only the cut points between the groups; MISSING=INCLUDE counts user-missing values in the statistics and lists them as valid; ORDER=VARIABLE gives a Statistics table per variable; the mode is the value with the largest weight; the minimum, maximum and range do not depend on the order of the table; GROUPED is supported, and DVALUE, AFREQ and DFREQ are ignored with percentiles, as is the median with AFREQ and DFREQ.
  • LOOP: when the index passes its last value, the index variable holds the counter (one step past the last value), and a zero-trip loop leaves the first value in it.
  • $CASENUM counts every case read in the data pass, also those a later SELECT IF drops.
  • N OF CASES limits the active dataset at the next data pass after GET too, after SELECT IF and SAMPLE.
  • SORT CASES turns SPLIT FILE off, with a warning.
  • FLIP makes user-missing values system-missing, writes NEWNAMES values in upper case with K_ before a number and _A, _B after a repeated name, numbers default names from VAR001 and keeps whole variable names in CASE_LBL.
  • SORT VARIABLES BY NAME compares the part before a number at the end first and the number after it, so the order never goes round in a circle.
  • VARSTOCASES and CASESTOVARS are supported.
  • AUTORECODE /BLANK=MISSING gives a blank string a user-missing code after the valid ones.
  • DATA LIST: the measurement level of the variables read follows the documented rules for unknown levels (the values decide, not the format), with SET SCALEMIN as the number of different values that makes a variable scale (GNU PSPP has no SCALEMIN).
  • SET BLANKS applies to every numeric variable, as documented, so a blank date field gets the BLANKS value too (GNU PSPP 2.0.1 makes it system-missing). Only a completely blank field takes it: a lone period stays system-missing (GNU PSPP gives it the BLANKS value).
  • SET EPOCH=AUTOMATIC brings back the window from 69 years before the current year (GNU PSPP 2.0.1 then refuses every two-digit year).
  • NPAR TESTS: the sign and McNemar tests use the binomial distribution up to 25 changes and the normal or chi-square approximation above (GNU PSPP is always exact); the two-sample median test has the documented continuity correction; the median of the median test is the middle case or the mean of the two middle cases; K-S with normal parameters taken from the data gives the Lilliefors significance, and the Smirnov significance uses the documented three terms; the Poisson K-S compares the distributions at each value and at the whole number below it; the Jonckheere-Terpstra statistic counts the pairs in the order of the groups; weights repeat the cases in the ranks of Mann-Whitney and Wilcoxon and in Cochran’s Q. Mann-Whitney adds the exact significance for small samples.
  • MEANS, CORRELATIONS, EXAMINE: undefined skewness and kurtosis are left empty; the CORRELATIONS listwise descriptives, the EXAMINE hinges with small weights, percentiles of small groups, CINTERVAL, listwise totals and the default descriptives table follow the documentation.
  • REGRESSION: METHOD takes variable lists and STEPWISE, FORWARD, BACKWARD and REMOVE; with ORIGIN the adjusted R square and the confidence intervals use C - p degrees of freedom, as the ANOVA does; Tolerance is 1 - R square of the variable on the other predictors; a user-missing value of the dependent or a predictor gives no predicted value or residual; saved variables are named PRE_1, RES_1 and so on.
  • RELIABILITY: the weight variable is used; SPLIT(n) puts n items in the second part, and SPLIT alone splits in halves, the odd item going to the first part.
  • FACTOR: standard deviations and covariances divide by W - 1; LISTWISE leaves out a case missing on any variable of VARIABLES, also one that is not on ANALYSIS; EXTRACTION without ROTATION leaves the factors unrotated; the default power of PROMAX is 4; rotated factors are ordered by their sums of squared loadings.
  • QUICK CLUSTER: with LISTWISE a case missing on a clustering variable gets no cluster, and saved values stay with their own case; the weight variable is used in the means.
  • LOGISTIC REGRESSION: METHOD takes FSTEP and BSTEP with COND, LR and WALD; interactions, every contrast type, CASEWISE and SAVE are supported.
  • UNIANOVA and GLM: a frequency weight is rounded to a whole number, as documented (GNU PSPP uses fractional weights as they are). An interaction with empty cells has as many degrees of freedom as its parameters that are not redundant (GNU PSPP counts every cell, filled or not). The Tests of Between-Subjects Effects show the Intercept. Covariates, Type IV sums of squares, EMMEANS, POSTHOC, CONTRAST, LMATRIX, SAVE and WSFACTOR are supported.
  • PRINT and WRITE: columns after a string variable give it an A format (GNU PSPP takes F and refuses); an asterisk may follow a format list; WRITE FORMATS keeps a write format apart from the print format, also in saved data files.
  • MATRIX: GET with MISSING=OMIT or a value also treats system-missing values, as documented (GNU PSPP stops). EOF is 1 after a READ that took the last record of the file (GNU PSPP waits for a READ past it). CDF.NEGBIN and PDF.NEGBIN count the trials up to the r-th success, from r (GNU PSPP counts the failures). The bivariate normal CDF integrates its density (GNU PSPP 2.0.1 gives values above 1), and PDF.LAPLACE is the density of CDF.LAPLACE (GNU PSPP’s is twice that). Unquoted RLABELS and CLABELS are in upper case. T, the function names and EIGEN, SETDIAG and SVD cannot name a matrix. WRITE starts in the column that FIELD names. CALL SVD gives Q the dimensions of the matrix and U and V square, as documented (GNU PSPP gives the thin decomposition). The half-normal, inverse Gaussian, studentized range and maximum modulus distributions and the noncentral functions are supported.

Syntax Statscraft accepts beyond the documentation

These are accepted where the documented syntax refuses them. Results on documented syntax do not change.

  • ADD FILES widens a string variable to its widest width across the files.
  • COUNT and RECODE accept MISSING for string variables.
  • CTABLES accepts MIN and MAX for MINIMUM and MAXIMUM, and a format before the label in a summary list.
  • COUNT is allowed inside DO IF.
  • A quoted string may run on over line breaks, blank lines included, until its closing quote; the breaks stay in the text. Survey tools write labels that way. An error after such a string says where it started, since a missing quote also makes a string run on.
  • PRESERVE and RESTORE store and bring back every setting (the custom currencies and the macro settings among them), so a SET subcommand name after them (PRESERVE LOCALE., as survey tools write) is accepted without a warning; other words are ignored with one. RESTORE LOCALE warns only when settings other than the ones it names (and DECIMAL, which a locale sets) changed after PRESERVE, since only then could a reading that restores the locale alone give other results. INCLUDE accepts the file name without FILE=. DISPLAY accepts FILE LABEL.
  • CTABLES /TITLES takes several quoted lines after TITLE, CAPTION and CORNER, as its subcommand diagram shows.
  • MULT RESPONSE has none of the documented size limits (20 groups, 100 variables, 5 dimensions, 200 rows and columns). A slash between two groups of GROUPS is accepted, as an example in the manual writes it.
  • FACTOR /CRITERIA takes DELTA(n) and KAPPA(n), the delta of OBLIMIN and the power of PROMAX when ROTATION gives none, as older versions of the syntax had them.
  • ANOVA takes the first analysis list without VARIABLES=, as the later lists of the manual’s examples are written.
  • SAVE TRANSLATE accepts TYPE=XLSX for TYPE=XLS /VERSION=12, and TYPE=XLS without VERSION when the file name ends in .xlsx. GET DATA reads a workbook by its content, whatever the extension or the TYPE says.
  • OUTPUT EXPORT takes /CSV DOCUMENTFILE=‘file’ [NOTESCAPTIONS=YES | NO], a Statscraft addition: each table as comma-separated values after its title, a blank line between tables.
  • MATRIX DATA and REPORT accept a slash before their first subcommand.
  • A MATRIX program may hold any number of SAVE statements (the manual allows 100). LOOP takes a comma in place of TO, as the manual’s BREAK example writes it, and &, | and ~ stand for AND, OR and NOT.

Choices where the documentation is silent

  • SET TVARS and TNUMBERS steer the variables and values in the headers, row labels and cells of every procedure’s tables; OVARS and ONUMBERS steer them in the table titles, which make the outline (the navigator of the window, the headings of exported output). BOTH puts the name before the label (q1 Satisfaction) and the value before its label (1 A great deal), as the Custom Tables manual shows values. Tables that give the name or value and the label in columns of their own (FREQUENCIES Value and Label, DESCRIPTIVES Variable and Label, the Between-Subjects Factors of UNIANOVA and GLM) keep both columns with LABELS and BOTH, so the value is never lost, and leave out the label column with NAMES or VALUES. SPLIT FILE LAYERED shows the groups as tables do, SEPARATE as titles do. CTABLES /VLABELS and MULT RESPONSE /FORMAT=NOLABELS win over the settings; CTABLES KEY=LABEL sorts by the value labels whatever the table shows. A nested GLM effect such as a(b) shows as DESIGN writes it, and parameter names such as [a=1] keep names and values. Warnings and errors, the dictionary and data listings (DISPLAY, SYSFILE INFO, LIST, PRINT), REPORT (which has label options of its own), the transformations (RANK, AUTORECODE, AGGREGATE) and the labels given to new variables keep names and labels as they are.
  • A logical operand other than 0, 1 or missing is an error. 0 ** 0 is missing.
  • RECODE COPY into a narrower string cuts the value. A reversed range such as 10 THRU 1 is turned around, with a warning.
  • Harmonic and geometric means need every value positive; otherwise the cell is empty.
  • MEANS shows one report per dependent variable. Its ANOVA uses the first control variable only.
  • A CORRELATIONS coefficient marked by NOSIG shows 3 decimals and stars, explained in a caption.
  • Levene’s test is based on the mean.
  • CROSSTABS shows Fisher’s exact test for every 2 x 2 table.
  • CROSSTABS /COUNT with a keyword left out takes CELL or ROUND, as the dialog writes /COUNT ROUND CELL; rounding takes halves away from zero.
  • A function name may be shortened to three or more letters that start only one function; a shared start such as STR (STRING, STRUNC) is an error.
  • Expression functions: SUBSTR, INDEX, RINDEX, LPAD and RPAD count characters like their CHAR. forms, so they never split a character (GNU PSPP counts bytes); LENGTH, STRUNC and MBLEN.BYTE count bytes. The range of x of a distribution is closed: CDF.UNIFORM(max, min, max) is 1 and CDF.PARETO(threshold, threshold, shape) is 0. XDATE.HOUR, MINUTE, SECOND, TDAY and TIME of a negative time interval are its parts with its sign, so -1:30:00 has hour -1 and minute -30 (GNU PSPP gives hour -2). DATEDIFF counts a month as complete when the day of the month and the time of day are reached; DATEDIFF and DATESUM also take the units in the singular and in any case. An empty padding string, a REPLACE count or STRUNC length that is not a whole number of at least 0, and a trimming argument that is not one character give the null string; REPLACE of an empty string changes nothing. MBLEN.BYTE at a byte inside a character gives the bytes of that character. MIN and MAX of strings compare as strings do (the shorter one padded with blanks) and take no .n. LNGAMMA is exactly 0 at 1 and 2.
  • RANK: a case with a missing, zero or negative weight gets no rank (GNU PSPP ranks a case of weight 0); missing values of BY variables form groups of their own; labels add “by” and the BY variables; a variable named twice is ranked once, with a warning.
  • FREQUENCIES shows the Statistics table only when statistics or percentiles are asked for or a frequency table is left out. LIMIT counts the missing values too. Values with equal frequencies stay in ascending order. Grouped percentiles: with a width or boundaries a percentile is interpolated within the first group whose cumulative weight reaches it; a value on a boundary belongs to the group above, except the last boundary; values outside the boundaries form open groups, where percentiles are undefined.
  • TREE: a predictor category smaller than MINCHILDSIZE joins its most similar allowed group during merging (smallest first), so a predictor that cannot give two large enough children is not chosen and the next best one is tried. Ties in merging and in the choice of predictor go to the first pair or predictor in order; the floating missing category stays apart when both choices are equally significant; exhaustive CHAID keeps the earliest of equally significant sets. The exhaustive CHAID multiplier of a nominal predictor is I(I^2 - 1)/6, the number of pairs it could merge summed over the steps, as the manual’s text defines it (its printed formula divides by 2, which gives 3 for two categories). FORCE splits the root whatever the significance. Nodes are numbered level by level; children follow the order of their smallest category, the missing category last. Adjusted significances above 1 show as 1. SAVE fills the cases in the analysis and leaves the others missing; a name given that already exists is an error, and default names get _1, _2 when taken. USEVALUES categories that do not occur get a warning and no row. The gain tables of the TARGET categories show without /GAIN too, unless CATEGORYTABLE=NO, as the subcommand’s defaults read. The case processing summary counts weighted cases.
  • NPAR TESTS: EXPECTED applies to the CHISQUARE before it. The binomial test with a proportion other than 0.5 is one-tailed in the observed direction, as the Command Syntax Reference describes (the Algorithms formula sums over the smaller category). Without values, the first value in the file is the first binomial category. K-W and J-T take every value between the two given ones that occurs, in the order from the first to the second. Two-sample K-S subtracts the distribution of the smaller group from that of the larger, as the Algorithms manual says (the first group when both are as large). Wald-Wolfowitz with ties across the groups shows the fewest and the most runs; up to 30 cases the significance is exact, above it the normal approximation of the runs test. The exponential K-S needs values of at least 0. Marginal homogeneity uses the values as scores and turns into the McNemar test with two values. Wilcoxon reports Z from the smaller rank sum, which says which ranks it is based on. METHOD=EXACT and METHOD=MC give exact significances for the binomial, sign, McNemar, Wilcoxon (given the tied ranks), Mann-Whitney (given the tied ranks) and runs tests, as exact results take the place of simulated ones; the other tests stay asymptotic with a warning. TIMER, CIN, SAMPLES, KS_SIM and SAMPLE are accepted and change nothing. A weight below 0.5 drops the case.
  • PARTIAL CORR: the significance is two-tailed by default, as the Command Syntax Reference says (the Algorithms manual says one-tailed). The partial of a variable with itself shows 1 with df 0. CONDENSED marks coefficients at 0.05 or less with * and at 0.01 or less with ** and shows them with three decimals; SERIAL leaves the lower half of a square matrix empty. With CORR, the zero-order block also shows the control variables.
  • EXAMINE: Shapiro-Wilk uses Royston’s algorithm for 3 to 5000 cases; the Lilliefors significance comes from a published table and shows “>0.200” beyond it; M-estimators start from the median, and a cell is empty when the absolute deviation is 0; percentiles below the first or above the last value take the minimum or maximum.
  • CTABLES significance tests: column letters run across the whole table (A, B, … then AA), so no two column groups share a letter; the Total of an outer variable is a subtable of its own and is tested; a period marks every column left out of a comparison; ADJUST defaults to BONFERRONI and MEANSVARIANCE to ALLCATS; significant means p below alpha (Benjamini-Hochberg: at most alpha); a repeated COMPARETEST of the same type replaces the earlier one; the means test needs MEAN, UMEAN alone does not qualify.
  • CTABLES layers give one table per layer category or combination, named in the title. A subtotal stays shown under EMPTY=EXCLUDE. KEY=function sorts categories without a value last and keeps value order for ties. Computed categories are left out of totals and tests. NEGPAREN, NEQUAL, PAREN and PCTPAREN show the number in the width of the format and add their marks outside it. )DATE and )TIME in titles are the local date and time as YYYY-MM-DD and HH:MM:SS. A function given twice in one summary list is two columns.
  • SPLIT FILE LAYERED merges the tables of the groups into one, the split variables as the outermost row labels; a column that only some groups have is empty in the others. SEPARATE names the group in each title. AUTORECODE recodes every case, also those a filter leaves out, and its new variables are nominal.
  • A data pass in which a case reads a value an earlier case left (a scratch variable it has not assigned, or LAG) runs case by case from the first such command to the end of the pass; a command that is not a transformation in between ends that part. TEMPORARY lasts until the end of a run at most.
  • DATA LIST: a blank line of LIST data is a case of missing values; a lone period is system-missing; with given delimiters a string keeps the blanks before it; two-digit years fall in the 100 years from SET EPOCH (AUTOMATIC: from 69 years back).
  • Multiple response sets: in a category set a value that is user-missing in any of its variables is a missing category, and an empty string counts as a value.
  • Macros: a body that ends with a period ends the calling command only when the call is the last thing in it; in the middle of a command (a title macro inside CTABLES) that period is dropped. Macro expressions compare as numbers when both sides are numbers and else as text with case. A macro variable that was never set stands for its own name. Expansion lines carry the line number of the call, and errors in them name the macro. A session (a command-line session or the window) keeps the macros and the macro settings of SET from run to run; a failed run or a check keeps none, and a run of a line range keeps only the macros defined on its lines, though one defined elsewhere in the text still serves it.
  • Syntax files: one that is valid UTF-8 is read as UTF-8, any other in the system’s legacy code page (on Windows its ANSI code page; elsewhere the locale’s character set, else windows-1252) unless --encoding names one. INSERT and INCLUDE paths are relative to the folder of the file that holds them, or to the folder of the last CD.
  • BEGIN PROGRAM blocks are skipped with one warning per block; the run goes on. A warning that every SPLIT FILE group gives (EXAMINE plots not drawn, for one) is shown once, without a group name.
  • STAR JOIN: a system-missing key matches nothing, as NULL in SQL; user-missing values match as values. Keys not named on SELECT come first in the result, then the SELECT fields, then the IN variables; SELECT * keeps every field in its file’s order. The weight, filter and split of FROM stay. PASSPROTECT with a password for an output file is refused, since Statscraft writes no encrypted files, and encrypted files cannot be read; STAR JOIN after TEMPORARY is refused, as MATCH FILES is.
  • DATASET ACTIVATE warns when the dataset it replaces has no name, since that one is closed. A command-line session keeps its named datasets between runs. MATCH FILES and ADD FILES (FILE, TABLE), AGGREGATE OUTFILE and APPLY DICTIONARY FROM take a dataset name, quoted or not, and an open dataset comes before a file of the same name; AGGREGATE OUTFILE writes into a dataset that DATASET DECLARE or DATASET NAME defined, and refuses the active dataset’s name (OUTFILE=* is that). GET FILE and SAVE OUTFILE take files only, as their syntax charts show; DATASET ACTIVATE and DATASET COPY do that for datasets.
  • Dates, times and custom currencies: a two-digit year form (DATE9, ADATE8) shows the last two digits of any year, as the manual says (GNU PSPP shows asterisks outside its century window); seconds that do not fit are cut off, never rounded up (GNU PSPP shows 59.999 seconds as 60.00); a date before 1582-10-14 and a WKDAY or MONTH out of range show as asterisks. In SET CCA to CCE a ’ makes the next period or comma text (GNU PSPP keeps the ’), and a positive number keeps no room for the negative suffix. FREQUENCIES, DESCRIPTIVES, MEANS and EXAMINE show the values and the statistics that lie on the variable’s scale (mean, median, mode, minimum, maximum, percentiles) of date, time and custom currency variables in their format; CTABLES does so for every variable, as the manual’s default. A standard deviation, standard error or range of dates shows as days and time (DTIME), and the sum and variance of dates, the variance of times and the statistics of WKDAY and MONTH variables beyond their values as plain numbers, where the default format would make a date of them. Category and group labels of date, time and custom currency variables show in their format in every procedure (CROSSTABS, MEANS, ONEWAY, T-TEST, EXAMINE, CTABLES and the split groups). The Data View shows dates, times and custom currencies in the variable’s format, following SET CCA to CCE, and edits dates as yyyy-mm-dd. The Excel export writes date, time and custom currency cells as numbers with an Excel number format, so Excel can compute with them: dates and times as Excel day numbers (month names as Jan, not JAN), custom currencies with their prefixes and suffixes, grouped and with the decimal mark of the reader’s Excel. What no Excel format shows stays text: JDATE, QYR, WKYR, DTIME, WKDAY, MONTH, negative times and dates before March 1900.
  • MULT RESPONSE: a value a case gives twice in a category group counts twice (the frequencies are summed over the variables, as described). Fractional weights count as they are; a case with a missing, zero or negative weight is left out, also from the missing cases. With BASE=CASES the row and column totals of a crosstabulation are the weighted responses of that category among the cases valid in the table, and the grand total the valid cases; with BASE=RESPONSES and in PAIRED tables they are sums of the cells. PAIRED pairs as many variables as the shortest category group of the table has; a pair with a missing or out-of-range value is skipped. Control variables give one block of rows per category in one table. CONDENSE shows values instead of labels in one column, not the printed three-column layout; DOUBLE and ONEPAGE are ignored with a warning. Group names show as written.
  • Random numbers: SET RNG=MC is the documented congruential generator and SET RNG=MT the Mersenne Twister started from MTINDEX as documented. UNIFORM, NORMAL and the RV functions draw one value per case they are evaluated for, in case order, and only for the cases a DO IF branch or IF condition chooses; COMPUTE draws for all cases of one command before the next command, except in a pass that runs case by case. The distributions use their documented algorithms where the text gives them (gamma: Ahrens and Dieter, Fishman) and else the standard ones (normal by its inverse, binomial, hypergeometric, negative binomial and Poisson by counting), so the values differ from other programs with the same seed. A parameter out of range gives system-missing and draws nothing. SEED=RANDOM and MTINDEX=RANDOM take the time of day in milliseconds and keep that number as the setting. SAMPLE uses the same generator. A new session starts from the default seeds; a command-line session goes on where its last run stopped.
  • FILE HANDLE: a handle stands for its path wherever a file is named, quoted or not, and as the first part of a path (‘handle/file.sav’); an open dataset of the same name comes first. A relative NAME starts from the folder of the last CD at the time FILE HANDLE runs. /ENCODING applies to DATA LIST, GET DATA, INSERT and INCLUDE when they give no encoding of their own; RECFORM and LRECL are ignored with a warning. SHOW HANDLES lists the handles.
  • SET FORMAT applies to new numeric variables of the commands after it that do not read a file. Settings that only change how output looks are accepted with a warning; SET CCA to CCE are followed. SET BLANKS gives its value to a completely blank numeric field of DATA LIST (fixed columns, and an empty value between delimiters or commas, inside an input program too), of GET DATA /TYPE=TXT and of NUMBER; a value missing at the end of a LIST line stays system-missing. SET EPOCH places a two-digit year in DATA LIST, GET DATA, NUMBER and the DATE. functions; YRMODA keeps the 1900s for years 0 to 99, as its own description says. SET FUZZBITS is the third argument of RND and TRUNC when it is left out. Each setting applies to the commands after it.
  • SET LOCALE: Statscraft always reads and writes Unicode, so a locale changes only the decimal mark (SET DECIMAL), as the manual says a later LOCALE does; the code page part of a name (.1257) changes nothing. The mark comes from the language (a code such as et or an English name such as Estonian), with a few countries that differ (de_CH, es_MX and others write a point). Statscraft starts with DECIMAL=DOT whatever the system’s locale, so a syntax reads the same on every computer, and SET LOCALE=OSLOCALE brings DOT back. A locale whose mark is not known keeps DECIMAL, with a warning. SET UNICODE=OFF has no effect and SHOW UNICODE stays ON.
  • SHOW takes every keyword the manual lists. A setting Statscraft does not follow shows what Statscraft uses with a note: no effect (speed, memory and messages) or output does not follow it; SCOMPRESSION is ON (SAVE compresses), TMSRECORDING NO, PLUGINS and EXTPATHS none, LICENSE MIT, ENVIRONMENT the operating system and processor, and $VARS lists the system variables Statscraft has.
  • DOCUMENT and ADD DOCUMENT add (Entered YYYY-MM-DD) after their lines. ALTER TYPE from string to number reads F, COMMA and DOT values; a type change drops value labels and missing values. AGGREGATE /PRESORTED is accepted; groups are formed by value either way.
  • SORT VARIABLES: D reverses the whole order, ties too. FORMAT orders by the type codes of the data file (A, COMMA, DOLLAR, F, … DATE …), then width and decimals. VALUES and MISSING put equal definitions together; ATTRIBUTE compares all values of the attribute, without regard to case, as LABEL does. A variable without a column width counts as 8 wide, a string as its width up to 32.
  • FLIP: a NEWNAMES value that does not start with a letter gets K_ too; a missing or blank one keeps the default name. CASE_LBL is as wide as the longest name, at least 8. Every case is transposed whatever FILTER says, and a table lists the new names.
  • ADD FILES, MATCH FILES and UPDATE: IN, FIRST and LAST are F1.0 and go at the end, IN in file order, then FIRST, then LAST. MAP shows the variables of the result at that point with their names in each file (GNU PSPP accepts MAP and shows nothing). The subcommands keep the manual’s order (FILE, TABLE, RENAME and IN before BY, FIRST, LAST, MAP, KEEP and DROP) and BY comes once. MATCH FILES needs BY for IN, and both commands for FIRST and LAST, as the manual says (GNU PSPP accepts them without). UPDATE has no FIRST or LAST, as its syntax chart shows. The result has the documents of every file, each file once.
  • VARSTOCASES: the new file holds ID, the copied variables, COUNT, INDEX and the MAKE variables, in that order. ID and INDEX are nominal (F8.0), COUNT is scale. An index of names holds them as the dictionary spells them. A MAKE variable may take the name of one of the FROM variables.
  • CASESTOVARS: with several index variables a name is the root and every index value, each after the separator; with one string index and several variables spread, the value follows the root and separator. Indicator names are the root and the index values without separator. A new variable’s label is the source’s label (else its name) and the index values, as in “Systolic, month = Jan”. A blank string counts like system-missing when deciding whether a variable varies and in ID and split variables. A row group that comes back after another one is an error (the data are not sorted). A fixed variable takes the first value of its group that is not missing. Order: split, ID and fixed variables as in the file, the variable groups, the indicators, COUNT.
  • REGRESSION: subcommands may come in any order; the last STATISTICS, CRITERIA and ORIGIN apply. PAIRWISE takes each variable’s mean and variance from its own valid cases and the smallest count of a pair as N. With ORIGIN the Descriptive Statistics show the real means, with standard deviations and correlations about 0. STEPWISE may remove any variable of the equation, also one an earlier METHOD put there, as its description reads; BACKWARD removes only its own; equal F values go to the variable named first, and MAXSTEPS limits each stepwise method. ENTER leaves out a variable that would break the tolerance, with a warning. Condition indices are the root of the ratio of the eigenvalues, as Belsley, Kuh and Welsch define them (the reference the manual gives; its printed formula has no root). The variance of the constant divides the residual mean square by the sum of case weight times REGWGT, as weighted least squares needs (the manual prints the sum of case weights, the same number without REGWGT). Cases outside the analysis (missing on a variable that is not in the equation, or on the dependent) get predicted values, their standard errors, intervals, leverage and Mahalanobis distance, and with a valid dependent the residuals by the manual’s formulas for such cases; Cook’s distance, DFBETA, DFFIT and COVRATIO only the cases of the analysis with a case weight of at least 1. Saved variables are F11.5 scale variables; a default name takes the smallest free number (PRE_1, then PRE_2); DFBETA(name) and SDBETA(name) give name0 for the constant and name1 and up for the variables in order (from 1 without a constant); MCIN and ICIN take no name; a name that exists is an error. Durbin-Watson shows on the last model and is empty with fractional weights. XTX shows the swept correlation matrix of the last model. The casewise and outlier tables cover the cases of the analysis. LABEL changes nothing.
  • RELIABILITY: the standardized alpha is always shown with ALPHA. The summaries of inter-item covariances and correlations run over every ordered pair of items, the variance dividing by k(k - 1) - 1, as the formula reads. The goodness-of-fit test of PARALLEL and STRICTPARALLEL uses the determinant of the constrained matrix as the manual’s “log of the determinant of the constrained matrix” gives it (its likelihood ratio formula prints k + 1 and 1/k where that matrix has k - 1 and 1/(k - 1)). FRIEDMAN and COCHRAN use the values as they are, so the items must be ranks within each case or 0 and 1. With ICC MODEL(MIXED) the average measures are computed as if there were no interaction, with a caption saying so. Cases with a zero or missing weight are not counted in the Case Processing Summary.
  • FACTOR: unrotated and oblique factors are reflected so that each column of loadings sums to a positive number, as the manual does for orthogonal rotations; oblique factors keep the order of the extraction. FORMAT=SORT groups the variables by the factor of their largest absolute loading, each group in descending order of it. With PAIRWISE each correlation’s significance uses its pair’s count, and Bartlett’s test and the ML and GLS chi-square use the smallest pair count. ML, GLS and ULS take their second derivatives as central differences of the exact first derivatives. A method or rotation that does not converge within ITERATE shows its last estimates with a warning. Orthogonal rotations stop when the simplicity criterion changes by at most RCONVERGE and no pair of factors turns by more than RCONVERGE in a pass, since the criterion alone can leave the loadings unsettled in the third decimal; OBLIMIN stops when its criterion changes by less than RCONVERGE times its starting value. Alpha factoring scales by H^-1/2, the only reading under which the manual’s communality update holds. Bartlett and Anderson-Rubin scores take U^2 as the unique variances, one minus the communalities. For oblique rotations the Rotation Sums of Squared Loadings are those of the structure matrix. Image factoring keeps only the factors whose eigenvalues are above 1. With one factor the rotation is skipped with a warning.
  • QUICK CLUSTER: clusters are numbered by the position of their initial center; a case equally near two centers goes to the lower-numbered one; a cluster that loses all its cases keeps its center during the iterations and gets an empty final center, with a warning. KMEANS(UPDATE) starts every pass counting each center as one case. PAIRWISE measures the distance over the variables a case has, without rescaling. Cluster Membership lists the clustered cases with their case numbers in the file.
  • LOGISTIC REGRESSION: the terms keep the order of the VARIABLES list (GNU PSPP puts the covariates that are not categorical first). Subcommands may come in any order; the last PRINT, CRITERIA, CASEWISE and SAVE apply. PRINT without DEFAULT still shows the default tables; SUMMARY shows the last step of each block. Newton-Raphson starts from all coefficients 0; BCON compares the absolute change of each coefficient. An entering term’s score is computed on its columns that are not redundant (EPS). A step that would return to a model already fitted in the method ends it, as the manual’s stepwise rules say; at most 200 steps. Hosmer-Lemeshow groups: the cases sorted by predicted probability, cases with equal predictions together, a group closing once the cumulative weight reaches its tenth of the total. Cook’s distance is z^2 h / (1 - h) as the Algorithms manual prints it. Leverage, Cook’s distance and DFBETA leave the case weight out, as the manual’s formulas do. The constant has no interval for Exp(B). PGROUP of a string dependent is saved as a string. Model if Term Removed shows for LR and COND. String covariates are categorical; a categorical variable needs two categories among the cases used. The Categorical Variables Codings show weighted frequencies.
  • UNIANOVA and GLM: the columns of an effect are the level combinations that occur in the data, so an L matrix lists one coefficient per occurring combination. Type IV spreads each coefficient of the tested effect equally over the cells of a containing effect at those levels of its other factors where every level with a coefficient has a cell, and sets the rest to 0. Estimated marginal means weight the cells of an effect equally over the levels not fixed by TABLES (with empty cells: over the cells that occur); a mean that is not estimable is left empty with a note. COMPARE adjusts for the k(k - 1)/2 pairs of the compared factor. CONTRAST compares the marginal means of the factor’s levels. Levene’s test uses the absolute residuals of the model in the cells of all factors; with a full factorial and no covariates also the median, the median with adjusted df and the 5% trimmed mean. POSTHOC uses the observed means with frequency weights and the model’s error mean square; T2, T3, GH and C need a model with one factor. With WSFACTOR the Tests of Between-Subjects Effects analyse the sum of the measures over the root of their number, the averaged tests use orthonormal polynomial contrasts whatever the contrast type, and the contrast type shapes the Tests of Within-Subjects Contrasts. Saved variables are F11.5 scale variables named PRE_1, RES_1 and so on.
  • CLUSTER: the cases are numbered in the order they are clustered, and the tables label them with their case numbers in the file. When two pairs are equally similar (to 1e-10 of their size) the pair with the lowest cluster numbers joins first. The clusters of a solution are numbered in the order of their first case. CORRELATION is Pearson’s correlation of the two cases’ values. A proximity that the measure leaves undefined (such as JACCARD of two cases with no presence) stops the command with an error naming the cases. The Proximity Matrix leaves its diagonal empty. With CENTROID, MEDIAN and WARD on a similarity measure the most similar pair joins and the update formulas stay those of the manual. Without PLOT no chart is asked for, so there is no warning; with VICICLE, HICICLE or DENDROGRAM the command warns that charts are not drawn yet. Saved memberships are F8.0 nominal variables labelled with the method and the number of clusters.
  • DISCRIMINANT: a group value that is not a whole number counts as out of range. Each function is reflected so that its standardized coefficients sum to a positive number. The Structure Matrix orders the variables by the function of their largest absolute correlation, within it by that correlation, and names the variables not entered. Classification needs the values of the entered variables only; MEANSUB puts the means of the analysis cases in place of missing ones. Classification counts use the case weights; cases with a zero weight are classified but count for nothing. PRIORS takes one value per group with cases or one per value of the GROUPS range. Box’s M covers all variables of the analysis block and leaves out groups with a singular covariance matrix; its F follows Box (1949), b = t2 / (1 - e1 + 2/t2) when e2 < e1 squared (the manual prints a minus before 2/t2). Cross-validation leaves out each case with its weight and keeps the entered variables and the priors. In a stepwise analysis the removal of level 1 variables starts once no variable of a higher level can enter; a lone variable is removed too when its F falls below FOUT. FPAIR shows the F of the last step. The stepwise tables are Variables Entered/Removed (with the criterion after each step), Wilks’ Lambda with Rao’s F, and the variables in and not in the analysis at every step.
  • ANOVA: UNIQUE uses the Type III hypotheses of the general linear model (the same sums of squares as the manual’s sum-to-zero coding when every cell has cases); the other methods take reductions in the error sum of squares, which do not depend on the coding. An order of interactions that is not of full rank (empty cells) is dropped with the orders above it, for every method, with a warning. With COVARIATES=WITH both combined rows show the covariates and main effects together, as the manual’s table of sums of squares gives them. Eta and the betas of MCA sum over every level of the factor (the manual’s printed sums start at the second level; Andrews et al. sum over all). The MCA columns adjusted for the factors are shown when there are no covariates, with HIERARCHICAL, or with EXPERIMENTAL and COVARIATES=AFTER. REG adds a Raw Coefficient column to the covariate rows. Cell Means cover each factor and combination of factors up to the highest order of the model. Weights are used as they are (UNIANOVA rounds them, as its documentation says).
  • PRINT, PRINT EJECT, PRINT SPACE, WRITE and XSAVE run when the data are next read and also in the pass at the end of a run; their output shows with the command that read the data. On the screen each PRINT EJECT starts a new table. PRINT to a file starts each line with a blank, or 1 after PRINT EJECT, and puts the period of a system-missing value where the decimal point would be, as GNU PSPP does. A file is written anew at every data pass. Without ENCODING a file is UTF-8 without a byte order mark. PRINT SPACE with a negative or missing count prints one line with a warning, as GNU PSPP does. WRITE needs the full width for a string variable, as its description says.
  • HOST is read and checked, then refused: a syntax file that runs operating system commands could do anything the user can.
  • CLEAR TRANSFORMATIONS returns the dataset, N OF CASES, TEMPORARY and the vectors to how the last data pass (or the end of the last run) left them; commands that touch no data, such as SET and TITLE, stay.
  • TITLE, SUBTITLE and ECHO show their text as a one-cell table where they stand; a blank TITLE or SUBTITLE shows nothing.
  • DATE: DATE_ reads cycle, month (JAN to DEC) or quarter, then year for long periods, and from the highest part to the lowest for short ones; each part is as wide as its largest possible value (four digits without a period), and MINUTE shows as M. The new variables get an F format as wide as their largest value.
  • Input programs: INPUT PROGRAM and FILE TYPE run when their END command comes, or at BEGIN DATA when they read inline data, so PRINT output from inside shows there. Transformations between a DATA LIST or input program and its BEGIN DATA run after the data are read. A run of an input program that reads no record and reaches no END FILE is an error, since it would repeat forever. $CASENUM inside counts the case being built. After END FILE or the end of the data the case being built is dropped; a DATA LIST that finds no more records after its END variable turned 1 ends the program. SKIP on a DATA LIST inside applies once, at the first record of its data. Scratch variables of the program are gone at its end. REREAD reads again the first record of the last case its data gave. A DATA LIST inside FILE TYPE reads the one record its RECORD TYPE matched.
  • REPEATING DATA: a record is at least 80 columns long, or as long as the longest record of its data, and the end column of STARTS and CONTINUED defaults to that length. ID reads its columns in F (no decimals) or A, as the variable is numeric or a string. A missing end column on STARTS gives no case and a warning; a missing LENGTH gives one case and a warning.
  • FILE TYPE: a record or case identifier without a name is not kept. In a grouped file undefined and skipped records do not end a case. In a nested file the records before the first one of the highest level are skipped without a warning, a record left without records below it at the end of the file gives no case (DUPLICATE=CASE makes one only when another record of its type follows), and a case identifier that differs from the one of the highest-level record gives a warning.
  • LEAVE outside an input program: the variables must not have existed when the data were last read; the transformations since then run again, case by case, with the variables kept from case to case.
  • GET DATA /TYPE=TXT: without DELIMITERS a tab or a comma separates values; a qualified value may hold line breaks; DATETIME values read as a date and a time of day in the usual orders; a format without width takes the width of the longest value (strings) or F8.2.
  • GET DATA /TYPE=XLSX, XLSM and XLS: CELLRANGE=FULL reads from the first to the last cell with a value; empty rows, and empty columns without a name, are left out. Without DATATYPEMIN a column is numeric only when all its values are numbers (TRUE and FALSE count as 1 and 0), a date when all are dates or times, else a string; numbers get F with 0 decimals when all are whole, else 2, at least 8 wide; dates get DATE11, times and durations TIME8, a mix or dates with a time DATETIME20. In a string column numbers read as short as they read back, dates as yyyy-mm-dd and times as hh:mm:ss. Error cells are empty. READNAMES makes a valid name: other characters become _, a V goes before a name that does not start with a letter, an _ after a reserved word, _2 and _3 after a repeated name; a column without a name is V and its number in the range. A string is as wide as its longest value; ASSUMEDSTRWIDTH caps it for every type (default 255 for XLS only), with a warning for each value cut.
  • MATRIX DATA: the rows of a triangle are mirrored, so every matrix in the file is square, as the procedures read it. Records keep the order of the data, a matrix where its first row was; the N record of /N comes first in its split. VARNAME_ is wider than A8 when a continuous variable has a longer name, so the procedures find every variable. The result is split by the split variables (SPLIT FILE LAYERED), so a procedure reads each set of materials on its own. Without SPLIT, data left after the records CONTENTS describes are an error, as are a matrix with too few rows and a value that is not a number, each naming its line; values left on a LIST record after its row are ignored with a warning, as the manual says for an upper triangle in lower format.
  • Output documents: they are named Document1, Document2 and so on. The window shows the tables of every document in its one Output view; the documents decide what OUTPUT EXPORT writes, including tables deleted from the view. The window session keeps its documents from run to run; a command-line run starts without any. OUTPUT ACTIVATE of a name no document has and OUTPUT CLOSE of one give a warning, so the run goes on. OUTPUT EXPORT /XLSX puts the tables one below the other on one sheet (SHEET, or Tables), a blank row between; MODIFYSHEET leaves one blank column (LASTCOLUMN) or row (LASTROW) before the new tables. CREATESHEET and MODIFYSHEET add only to a workbook that OUTPUT EXPORT wrote in the same session and that has not changed since, because the whole workbook is written again and what Statscraft did not write (formulas, charts, formatting) would be lost; other workbooks are refused with an error. ENCODING=LOCALE writes UTF-8. In TEXT the columns are as wide as their widest cell (COLUMNWIDTH=n wraps at n characters) and numbers align right.
  • REPORT: the weight counts as in the other procedures (VALIDN is the sum of the weights). MEDIAN, MODE, FREQUENCY and PERCENT cut each value to a whole number and count those in the range; the median is the middle value, the mean of the two middle values when the weights split evenly between them; the mode is the most frequent value, the lowest of a tie; PERCENT is per cent of all valid values. FREQUENCY and PERCENT give one line per value of the range, titled with the value, then a line with the total under the summary title. A function without valid values is missing. TOTAL repeats the first SUMMARY of the first BREAK for all cases at the end, under a line Grand Total. A report without break columns puts its summary titles in a column of their own. The report is one page: LENGTH, PAGE and PREVIEW change nothing and )PAGE is the PAGE1 number. The shown table leaves out the blank lines; OUTFILE writes the text with them and shows no table, and the first REPORT of a session that names a file starts it anew, later ones append. A numeric part of STRING that does not fit its width in the variable’s format is shown without decimals.
  • FINISH ends the run as the end of the syntax does: nothing after it is read. A window or command-line session stays open, with its dataset. With a line range only a FINISH inside the range counts. Macros that the lines after FINISH define are still defined, since macros are expanded before the commands are read.
  • END DATA, END REPEAT and END MATRIX standing alone are errors at their line, saying which command they belong to.
  • MATRIX: PRINT gives a table with row labels (row1, row2, … unless RLABELS or RNAMES give them) and column labels (col1, col2, …), as the manual describes for tables; SPACE does not change a table. Without FORMAT whole numbers below 10^9 show without decimals and other numbers with ten significant digits in one format; when the largest value is 10^9 or more, or all are below 10^-3, the values are divided by a power of 10 that the caption names. Infinities and undefined values show as +Inf, -Inf and NaN: division by zero follows floating point, while LN, LG10, SQRT, ARSIN, PROBIT, INV and the like check their arguments. An error stops the program at its statement, with its line and column, and nothing is saved or written; SAVE, MSAVE and WRITE write their files at END MATRIX. COMPUTE of a scalar into a part of a matrix fills that part (GNU PSPP refuses). RND rounds a half away from zero, as RND does in COMPUTE (GNU PSPP rounds it to even). DESIGN orders the columns of a variable by value. MAGIC gives the Siamese square for odd sizes, the complement square for multiples of 4 and the LUX square for other even sizes (GNU PSPP gives other squares for even sizes). Eigenvectors and singular vectors have length 1 and their largest element positive. GET /NAMES gives a row vector, one name per column (GNU PSPP gives a column), and GET of the active dataset reads every case, also those FILTER leaves out. A LOOP index keeps the value of its last iteration; a loop that MXLOOPS stops gives a warning; BY 0 is an error. UNIFORM and NORMAL with two scalars give a matrix of draws, with one argument a draw per element; they and the RV functions draw from the generator SET RNG chooses, in the order COMPUTE draws case by case. A distribution or random function with a parameter out of range is an error. READ takes a blank fixed field as missing (NaN) and fills what the file does not reach with missing values, with a warning. RELEASE of a name that does not exist gives a warning.
  • SAVE TRANSLATE: lines end with CR LF (RFC 4180). A CSV value is qualified when it holds the delimiter, the qualifier or a line break. The manual gives two rules for the default delimiter; Statscraft makes it a semicolon whenever the decimal mark in use is a comma (TEXTOPTIONS DECIMAL, else SET DECIMAL), so a number never needs quotes. FORMAT=PLAIN writes a date with a time of day as mm/dd/yyyy hh:mm:ss and a time with its fraction of a second when it has one; FORMAT=VARIABLE widens a number that does not fit its format instead of writing asterisks. A workbook keeps the display format of each number (dates and times as Excel dates, as in the table export); with MISSING=RECODE a numeric user-missing value is #NULL! like system-missing, a string one empty. Without EXCELOPTIONS the sheet is Sheet1; further sheets for more cases add (2), (3).

Not supported yet

  • Commands. The list of commands of the language that Statscraft recognises but does not run is at the end of the command index. That list is generated from the program, so it is always current. A script that uses one stops at that line, and nothing is changed.
  • Subcommands. Every command page lists what it accepts. Notably: FREQUENCIES draws no charts (BARCHART, PIECHART and HISTOGRAM are accepted with a warning); ONEWAY has no POLYNOMIAL, RANGES, EFFECTS or WALLER; NONPAR CORR has no MATRIX or CI; PARTIAL CORR has no MATRIX; NPAR TESTS has no exact significance for K-S, the median, Kruskal-Wallis, Jonckheere-Terpstra, Friedman, Kendall, Cochran and marginal homogeneity tests; EXAMINE computes the normality tests but draws no plots (STEMLEAF, BOXPLOT and HISTOGRAM are accepted with a warning, SPREADLEVEL is refused); REGRESSION has no METHOD=TEST, SELECT, MATRIX or OUTFILE and draws no plots (HISTOGRAM, NORMPROB, SCATTERPLOT, PARTIALPLOT and TEMPLATE are accepted with a warning); RELIABILITY has no MODEL=OMEGA or MATRIX; LOGISTIC REGRESSION has no SELECT or OUTFILE and draws no CLASSPLOT (accepted with a warning); UNIANOVA and GLM have no multivariate model (GLM with several dependents without WSFACTOR), RANDOM, TEST, ROBUST, OUTFILE, MMATRIX, MEASURE, POSTHOC VS, CONTRAST SPECIAL or the heteroskedasticity tests, draw no plots (PLOT is accepted with a warning), and with WSFACTOR have no EMMEANS, POSTHOC, CONTRAST, LMATRIX or SAVE; FACTOR has no METHOD=COVARIANCE, MATRIX=OUT or MATRIX=IN(FAC=…) and draws no plots (PLOT is accepted with a warning); CLUSTER has no MATRIX=OUT and draws no icicle plot or dendrogram (PLOT is accepted with a warning); DISCRIMINANT has no ROTATE=COEFF or STRUCTURE, MATRIX or OUTFILE, and PLOT (charts, the territorial map and the casewise listing) is accepted with a warning; USE takes case numbers only with /PERMANENT; ADD FILES, MATCH FILES and UPDATE take no PASSWORD; GET DATA reads no ODBC or OLEDB sources; SAVE TRANSLATE writes CSV, TAB and Excel 2007 workbooks only (no SAS, Stata, dBASE, 1-2-3, SYLK, ODBC or the older binary Excel files), has no APPEND or MAP, and RENAME takes valid variable names only; FILE HANDLE refuses MODE=BINARY, MULTIPUNCH, IMAGE and 360, since only text and data files are read.
  • Expression functions. APPLYMODEL and STRAPPLYMODEL, which need MODEL HANDLE. NUMBER reads the formats DATA LIST reads (F, N, E, COMMA, DOT, DOLLAR, PCT, DATE, ADATE, EDATE and SDATE); STRING writes the number, date and time formats but not the custom currencies CCA to CCE.
  • Transformations. PRINT and WRITE have no binary formats (P, PK, IB, PIB, PIBHEX, RB, RBHEX, Z); EXPORT and IMPORT (portable files) are not supported, since the manuals do not describe the file format; DATA LIST reads only F, N, E, COMMA, DOT, DOLLAR, PCT, A, DATE, ADATE, EDATE and SDATE and UTF-8 files; commands such as VALUE LABELS cannot stand inside LOOP; AUTORECODE has no templates.
  • Charts. No command draws charts yet. TREE shows its tree diagram as a table, one row per node indented by depth, and says so in a warning.
  • TREE. CHAID and exhaustive CHAID with a nominal or ordinal dependent. Not supported yet: CRT, QUEST, a scale dependent, split-sample and cross-validation, SPLITMERGED=YES, custom costs, profits, percentile gain tables, rules, influence variables, model files and TARGETRESPONSE.
  • Data files. Statscraft reads and writes .sav and .zsav files. Portable (.por) files cannot be read yet. Text files are read with DATA LIST and GET DATA, workbooks (.xlsx, .xlsm, .xls) with GET DATA; SAVE TRANSLATE writes CSV, tab-delimited text and .xlsx. An old .sav file that does not state its code page is read as Western European (windows-1252); there is no way to choose another encoding yet.
  • Output. Tables come out as Markdown, JSON, HTML (from the window and OUTPUT EXPORT), text and CSV (OUTPUT EXPORT) and Excel workbooks. Statscraft has no output document file of its own, so OUTPUT SAVE is refused with an error that points to OUTPUT EXPORT; OUTPUT OPEN and OUTPUT MODIFY are not supported. OUTPUT EXPORT writes no Word, PDF, PowerPoint or Excel 97-2004 files, and no images, since no command draws charts yet.
  • Installer. The Windows installer is not signed yet, and there are no packages for macOS or for ARM processors.

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

Statscraft 0.7.0, release v0.7.0

DATA LIST

Define text data, inline or in a file, and read it as the new active dataset.

Syntax

DATA LIST [FILE='path'] [FIXED | FREE [(delimiters)] | LIST [(delimiters)]] [RECORDS=n] [SKIP=n]
          [END=var] /[record] var [TO var] columns [(type[,decimals])] | (formats) [/ ...].
FIXED (the default): columns such as 1-3, or formats such as (F2.0, 1X, A10) with Tn and nX.
FREE and LIST: var [(format)], values separated by blanks and commas or by the delimiters
given as quoted characters or TAB; LIST reads one case per line. * ends a run of F8.2 variables.
Without FILE the data follow between BEGIN DATA and END DATA; transformations may stand
between. Inside INPUT PROGRAM each run reads the next case's records into the case being
built; without variables it passes over a record. END (fixed data in an input program
only) names a variable that is 0, and 1 once the data are used up.
Formats: F, N, E, COMMA, DOT, DOLLAR, PCT, A, DATE, ADATE, EDATE, SDATE.
A value that cannot be read is system-missing, with a warning naming its line.

Example

DATA LIST LIST /id (F3) name (A12) score.

statscraft help DATA LIST prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

BEGIN DATA

Inline data for the DATA LIST before it, up to a line that holds END DATA.

Syntax

BEGIN DATA
data lines
END DATA.
BEGIN DATA and END DATA each stand alone on their line. Every line between is data.

Example

BEGIN DATA
1 'Ann' 12.5
END DATA.

statscraft help BEGIN DATA prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

INPUT PROGRAM

Start an input program: commands that build the cases of a new active dataset.

Syntax

INPUT PROGRAM.
  DATA LIST, REREAD, REPEATING DATA, END CASE, END FILE and transformations
END INPUT PROGRAM.
The commands run again and again, each time from the top, until a DATA LIST runs out
of data or END FILE runs. Each run builds a case at its end, or at each END CASE when
the program has one. Before each case the variables are blank or system-missing again,
except scratch variables and those named on LEAVE. A run that reads no record and does
not end the file is an error, since it would repeat forever. SELECT IF, SAMPLE, FILTER,
TEMPORARY and procedures cannot stand inside. The program runs right away, or at
BEGIN DATA when it reads inline data.

Example

INPUT PROGRAM.
DATA LIST /#n 1 head 3-4 (A).
LEAVE head.
LOOP #i = 1 TO #n.
DATA LIST /item 1-2.
END CASE.
END LOOP.
END INPUT PROGRAM.

statscraft help INPUT PROGRAM prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

END INPUT PROGRAM

End an input program and run it.

Syntax

END INPUT PROGRAM.

Example

INPUT PROGRAM.
LOOP #i = 1 TO 5.
COMPUTE x = #i.
END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.

statscraft help END INPUT PROGRAM prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

END CASE

In an input program: add the case built so far to the dataset and go on.

Syntax

END CASE.
The program goes on with the command after END CASE, with the variables blank or
system-missing again except scratch and LEAVE variables. With END CASE in a program
no case is built at the end of a run.

Example

LOOP #i = 1 TO 3.
COMPUTE x = v(#i).
END CASE.
END LOOP.

statscraft help END CASE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

END FILE

In an input program or FILE TYPE: stop reading; the case being built is dropped.

Syntax

END FILE.
Usually inside DO IF. Put END CASE before it to keep the case being built.

Example

DO IF year >= 1881.
END FILE.
END IF.

statscraft help END FILE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

LEAVE

Keep the values of new variables from case to case instead of resetting them.

Syntax

LEAVE varlist.
The variables must be new: made by the transformations since the data were last read,
before LEAVE, and not scratch variables. A numeric one starts at 0 for the first case,
a string one blank; each later case starts with the value the case before ended with.
In an input program the variables are not reset before each case.

Example

COMPUTE total = total + salary.
LEAVE total.

statscraft help LEAVE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

REREAD

In an input program: let the next DATA LIST read the last record again.

Syntax

REREAD [FILE='path' | handle] [COLUMN = expression].
COLUMN makes that column of the record column 1 for the DATA LIST (default 1). FILE
names the data of the DATA LIST to reread (default: the last DATA LIST's); a DATA
LIST that reads other data ignores the REREAD. Of several REREAD commands in a row
the last counts.

Example

DATA LIST /kind 10-14 (A).
DO IF kind = 'FORD'.
REREAD.
DATA LIST /price 3-6 (DOLLAR,2).
END CASE.
END IF.

statscraft help REREAD prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

REPEATING DATA

In an input program or FILE TYPE: one case per repeating group of a record.

Syntax

REPEATING DATA [FILE='path' | handle] [/ENCODING='UTF-8'] /STARTS=column[-column]
    /OCCURS=n [/LENGTH=n] [/CONTINUED[=column[-column]]] [/ID=columns=var]
    [/TABLE | /NOTABLE] /DATA=variables as on DATA LIST.
STARTS, OCCURS, LENGTH and the end column on STARTS take a number or a variable.
Reads OCCURS groups from the record the last DATA LIST read, starting in column
STARTS; the columns on DATA count from the start of a group. A group is LENGTH
columns, by default up to the last variable or skip. Each group gives a case with the
values of the other variables spread to it. CONTINUED: groups that do not fit before
the end column (default 80, or the longest record) go on in the next records, from
the column given (default 1); ID checks that an identifier on those records matches.
OCCURS missing or below 1 gives no case.

Example

DATA LIST /seqnum 2-4 numveh 9-10.
REPEATING DATA STARTS=12 /OCCURS=numveh
 /DATA=make 1-8 (A) model 9 (A) numcyl 10.

statscraft help REPEATING DATA prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

FILE TYPE

Start the definition of a file with several kinds of records.

Syntax

FILE TYPE MIXED | GROUPED | NESTED [FILE='path' | handle] [ENCODING='UTF-8']
    RECORD=[var] columns [(format)] [CASE=[var] columns [(format)]]
    [WILD=WARN | NOWARN] [DUPLICATE=WARN | NOWARN | CASE] [MISSING=WARN | NOWARN]
    [ORDERED=YES | NO].
RECORD TYPE value ... / DATA LIST ... pairs follow, then END FILE TYPE.
MIXED: each record of a listed type is a case; others are skipped. GROUPED: the
records with one CASE value make one case (CASE required). NESTED: the RECORD TYPE
commands go from the highest level to the lowest; each lowest-level record is a case
with the values of the records above it. Defaults: WILD=NOWARN (WARN for grouped),
DUPLICATE and MISSING WARN for grouped and NOWARN for nested, ORDERED=YES (grouped
only); DUPLICATE=CASE (nested) makes a case of a record that has no records below it.

Example

FILE TYPE GROUPED RECORD=#test 6 CASE=student 1-4.
RECORD TYPE 1.
DATA LIST /english 8-9 (A).
RECORD TYPE 2.
DATA LIST /reading 8-10.
END FILE TYPE.

statscraft help FILE TYPE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

RECORD TYPE

Inside FILE TYPE: the record types the following DATA LIST reads.

Syntax

RECORD TYPE value [value ...] | OTHER [SKIP] [CASE=columns] [DUPLICATE=WARN | NOWARN]
    [MISSING=WARN | NOWARN] [SPREAD=YES | NO].
Values are numbers, or quoted strings for a string record identifier. OTHER stands
for every type not named before and comes last. SKIP passes over the records. CASE
gives other columns for the case identifier; DUPLICATE (grouped) and MISSING apply to
these types only. SPREAD=NO (nested): the values go to the first case built under the
record only.

Example

RECORD TYPE 21, 22, 23.
DATA LIST /sex 5 age 6-7.

statscraft help RECORD TYPE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

END FILE TYPE

End a FILE TYPE definition and read the file.

Syntax

END FILE TYPE.

Example

FILE TYPE MIXED RECORD=recid 1-2.
RECORD TYPE 23.
DATA LIST /sex 5 age 6-7.
END FILE TYPE.

statscraft help END FILE TYPE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

MATRIX DATA

Read matrix materials (correlations, means, counts) as a matrix data file.

Syntax

MATRIX DATA VARIABLES=varlist [/FILE=INLINE | 'path'] [/FORMAT=[LIST | FREE] [LOWER | UPPER | FULL]
            [DIAGONAL | NODIAGONAL]] [/SPLIT=varlist] [/FACTORS=varlist] [/CELLS=n] [/N=n]
            [/CONTENTS=[CORR] [COV] [MAT] [MSE] [DFE] [MEAN] [STDDEV | SD] [N_VECTOR | N] [N_SCALAR]
            [N_MATRIX] [COUNT] [PROX] [(types of within-cells records) ...]].
The new active dataset holds the split variables (F4.0), ROWTYPE_ (A8), the factors (F4.0),
VARNAME_ (A8, wider for longer names) and the continuous variables (F10.4): those of
VARIABLES that are neither ROWTYPE_ nor a split or factor, which come last on VARIABLES.
With ROWTYPE_ on VARIABLES each record starts with its fields in the order of VARIABLES:
the record type (a name or a three-letter abbreviation, quoted or not) and the split and
factor values (. for a pooled record). Without it CONTENTS gives the records in order, CORR
when left out; types in parentheses are within-cells records, read for each of the CELLS
cells with the factor values first. A matrix has one record per variable: LOWER and UPPER
give a triangle, which is mirrored, FULL the whole matrix; with NODIAGONAL a correlation
diagonal is 1 and any other diagonal missing. N_SCALAR gives one value for every variable.
N=n adds an N record to each split. LIST starts each row on a new record (a row may go on
over the next records; values left on a record are ignored with a warning), FREE reads the
values as one stream. Values are separated by blanks or commas, and by + and - when not
after D or E; . is missing. SPLIT may name one variable that is not on VARIABLES: the sets
of materials are then numbered 1, 2, ... The result is split by the split variables. The
data follow between BEGIN DATA and END DATA, or come from FILE. FACTOR, CLUSTER and the
other procedures with MATRIX=IN(*) read it.

Example

MATRIX DATA VARIABLES=ROWTYPE_ v1 TO v3 /FORMAT=UPPER NODIAGONAL.
BEGIN DATA
MEAN 5 4 3
SD 3 2 1
N 9 9 9
CORR .6 .7
CORR .8
END DATA.

statscraft help MATRIX DATA prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

MATRIX

Run a program in the matrix language, up to END MATRIX.

Syntax

MATRIX.
  COMPUTE m = expr | m(rows, cols) = expr.
  CALL EIGEN(m, vectors, values) | SETDIAG(m, v) | SVD(m, u, q, v).
  PRINT [m] [/FORMAT=format] [/TITLE='text'] [/SPACE=n | NEWPAGE]
        [/RLABELS=labels | /RNAMES=vector] [/CLABELS=labels | /CNAMES=vector].
  DO IF expr. ... [ELSE IF expr. ...] [ELSE. ...] END IF.
  LOOP [i = first TO last [BY step]] [IF expr]. ... [BREAK.] ... END LOOP [IF expr].
  READ m [/FILE=file] /FIELD=c1 TO c2 [BY w] [/SIZE=expr] [/MODE=RECTANGULAR | SYMMETRIC]
        [/REREAD] [/FORMAT=format].
  WRITE m [/OUTFILE=file] /FIELD=c1 TO c2 [BY w] [/MODE=RECTANGULAR | TRIANGULAR] [/HOLD]
        [/FORMAT=format].
  GET m [/FILE=file | *] [/VARIABLES=varlist] [/NAMES=name] [/MISSING=ACCEPT | OMIT | value]
        [/SYSMIS=OMIT | value].
  SAVE m [/OUTFILE=file | *] [/VARIABLES=names] [/NAMES=vector] [/STRINGS=names].
  MGET [/FILE=file | *] [/TYPE=COV CORR MEAN STDDEV N COUNT].
  MSAVE m /TYPE=COV | CORR | MEAN | STDDEV | N | COUNT [/OUTFILE=file] [/VARIABLES=names]
        [/SNAMES=names] [/SPLIT=vector] [/FNAMES=names] [/FACTOR=vector].
  DISPLAY [DICTIONARY] [STATUS].
  RELEASE m [, m ...].
END MATRIX.
Matrices: {1, 2; 3, 4} (commas between elements, semicolons between rows; the parts may be
matrices), a:b and a:b:step for whole numbers, m(i, j) and v(i) with vectors of positions or
: for all.
Operators from the tightest: unary -, :, ** (matrix power) and &**, * (matrix product), /
&* and &/ (elementwise), + -, < <= > >= = <> (or LT LE GT GE EQ NE), NOT, AND, OR and XOR;
a scalar goes with any matrix. PRINT, WRITE, SAVE and MSAVE take a name, a call, a matrix in
braces or a power of one; other expressions go in parentheses, as (A+B). In the expression of
a subcommand a slash starts the next subcommand, so a division goes in brackets.
Functions: ABS ALL ANY ARSIN ARTAN BLOCK CHOL CMAX CMIN COS CSSQ CSUM DESIGN DET DIAG EOF EVAL
EXP GINV GRADE GSCH IDENT INV KRONEKER LG10 LN MAGIC MAKE MDIAG MMAX MMIN MOD MSSQ MSUM NCOL
NROW RANK RESHAPE RMAX RMIN RND RNKORDER RSSQ RSUM SIN SOLVE SQRT SSCP SVAL SWEEP T (TRANSPOS)
TRACE TRUNC; UNIFORM(rows, cols) and NORMAL(rows, cols) give random matrices, UNIFORM(max) and
NORMAL(sd) random elements; CDFNORM CHICDF FCDF TCDF PROBIT and the families CDF.x, IDF.x,
PDF.x, NCDF.x, NPDF.x, SIG.x and RV.x work element by element, a scalar argument going with any
matrix.
PRINT gives a table; without FORMAT the numbers share one format and are divided by a power
of 10, named in the caption, when they are very large or small. A string element holds up to
8 bytes and prints with an A format. Every loop, also one with an index, stops after SET
MXLOOPS iterations (default 40) with a warning. The first READ, WRITE, SAVE and MSAVE name
their file; later ones use the last one named. SAVE, MSAVE and WRITE write their files at END
MATRIX; SAVE /OUTFILE=* replaces the active dataset then. An error stops the program at its
statement, and nothing is saved.

Example

MATRIX.
COMPUTE A = {4, 2; 2, 3}.
CALL EIGEN(A, V, E).
PRINT E /TITLE='Eigenvalues'.
PRINT INV(A) /FORMAT=F8.3.
END MATRIX.

statscraft help MATRIX prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

GET

Read a data file and make it the active dataset.

Syntax

GET FILE='path' | handle [/KEEP=varlist] [/DROP=varlist] [/RENAME=(old = new) ...].
KEEP, DROP and RENAME work in the order written, as in ADD FILES.

Example

GET FILE='survey.sav'.

statscraft help GET prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

SAVE

Write the active dataset to a data file.

Syntax

SAVE OUTFILE='path' | handle [/COMPRESSED | /UNCOMPRESSED | /ZCOMPRESSED] [/KEEP=varlist] [/DROP=varlist]
     [/RENAME=(old = new) ...].
KEEP, DROP and RENAME shape the saved file only; the active dataset stays as it is.

Example

SAVE OUTFILE='survey_clean.sav' /COMPRESSED.

statscraft help SAVE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

VARIABLE LABELS

Set the labels of variables.

Syntax

VARIABLE LABELS var 'label' [[/] var 'label' ...].

Example

VARIABLE LABELS age 'Age in years' / region 'Home region'.

statscraft help VARIABLE LABELS prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

VALUE LABELS

Replace the value labels of variables.

Syntax

VALUE LABELS varlist value 'label' [value 'label' ...] [/ varlist ...].
Values are numbers or quoted strings. A varlist with no labels removes its labels.

Example

VALUE LABELS gender 1 'Male' 2 'Female' / plan 'b' 'Basic' 'p' 'Premium'.

statscraft help VALUE LABELS prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

MISSING VALUES

Declare user-missing values.

Syntax

MISSING VALUES varlist (values) [[/] varlist (values) ...].
values: up to three values, or one range with at most one extra value.
range: low THRU high, LOWEST THRU high, low THRU HIGHEST (LO and HI also work).
Empty parentheses clear the missing values.

Example

MISSING VALUES q1 q2 (98, 99) / income (LOWEST THRU -1, 999999) / plan ().

statscraft help MISSING VALUES prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

VARIABLE LEVEL

Set the measurement level of variables.

Syntax

VARIABLE LEVEL varlist (SCALE | ORDINAL | NOMINAL) [[/] varlist (...) ...].

Example

VARIABLE LEVEL age (SCALE) / q1 TO q5 (ORDINAL).

statscraft help VARIABLE LEVEL prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

VARIABLE WIDTH

Set how many characters wide variables show in the data grid.

Syntax

VARIABLE WIDTH varlist (n) [[/] varlist (n) ...].
n: a whole number of characters, at least 1. Saved with the data; formats and output stay as they are.

Example

VARIABLE WIDTH comment (40) / id age (5).

statscraft help VARIABLE WIDTH prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

FORMATS

Set the display format of variables.

Syntax

FORMATS varlist (format) [[/] varlist (format) ...].
format: type, width and optional decimals, for example F8.2, A20, DATE11.
Output shows values in the format: DATE11 28-OCT-1990, DATE9 28-OCT-90, ADATE10 10/28/1990,
TIME8 01:02:34, TIME5 01:02 (what the width cannot show is cut off), CCA to CCE as SET defines.
Procedures show the mean, median, mode, minimum, maximum and percentiles of a date, time or
custom currency variable in its format; a spread of dates as days and time (DTIME).

Example

FORMATS income (COMMA10.2) / age (F3).

statscraft help FORMATS prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

FREQUENCIES

Frequency tables, summary statistics and percentiles.

Syntax

FREQUENCIES [/]VARIABLES=varlist [/FORMAT=[NOTABLE | LIMIT(n)] [AVALUE | DVALUE | AFREQ | DFREQ]]
            [/MISSING=INCLUDE] [/STATISTICS=[stat ...]] [/PERCENTILES=p ...] [/NTILES=n]
            [/GROUPED=varlist [(width) | (boundary, ...)]] [/ORDER=ANALYSIS | VARIABLE]
            [/BARCHART=...] [/PIECHART=...] [/HISTOGRAM=...].
stat: MEAN SEMEAN MEDIAN MODE STDDEV VARIANCE SKEWNESS SESKEW KURTOSIS SEKURT RANGE MINIMUM
MAXIMUM SUM DEFAULT ALL NONE. STATISTICS alone or DEFAULT is MEAN STDDEV MINIMUM MAXIMUM; /STATS works too.
A frequency table per variable: valid values, then missing ones, with percent, valid percent and
cumulative percent. NOTABLE leaves the tables out, LIMIT(n) the tables with more than n values.
DVALUE, AFREQ and DFREQ order the values by descending value or by frequency (ties ascending by
value); they are ignored when percentiles or a histogram are asked for. A Statistics table, one for
all variables (ORDER=VARIABLE: one per variable, before its frequency table), shows the valid and
missing counts and the statistics; it appears when statistics or percentiles are asked for, or when
a frequency table is left out. Percentiles use (W + 1) p, the median is the 50th percentile and is
left out with AFREQ and DFREQ; MODE shows the smallest of tied modes, with a note. NTILES=n adds the
n - 1 points that cut the cases into n equal groups; several PERCENTILES and NTILES add up.
GROUPED treats the values as groups for the median and percentiles: alone the values are group
midpoints, (width) groups that wide around each value, (boundaries) the given groups; a value
outside the boundaries falls in an open group, where percentiles are undefined (shown empty).
INCLUDE makes user-missing values valid. Weighted when a weight variable is set; a case with a
missing, zero or negative weight is left out. String variables get the table and the counts only.
BARCHART, PIECHART and HISTOGRAM are accepted (BARCHART and HISTOGRAM not together) and not
drawn yet, with a warning.

Example

FREQUENCIES VARIABLES=age region /FORMAT=LIMIT(10) /STATISTICS=MEAN MEDIAN MODE /NTILES=4.

statscraft help FREQUENCIES prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

EXECUTE

Run the pending transformations.

Syntax

EXECUTE.

Example

EXECUTE.

statscraft help EXECUTE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

COUNT

Count, per case, how many variables hold one of the listed values.

Syntax

COUNT target = varlist (values) [varlist (values) ...] [/ target = ...].
values: values, low THRU high (with LOWEST or HIGHEST), MISSING, SYSMIS.
A value or range counts user-missing values too; a string variable takes quoted values only.

Example

COUNT channels = q5_1 TO q5_5 (1) / unanswered = q1 q2 (MISSING).

statscraft help COUNT prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

SORT CASES

Sort the cases by the values of variables.

Syntax

SORT CASES [BY] varlist [(A | D)] [varlist [(A | D)] ...].
A is ascending (the default), D descending; a direction covers the variables before it.
System-missing sorts lowest. Cases with equal keys keep their order.

Example

SORT CASES BY region (A) age (D).

statscraft help SORT CASES prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

SORT VARIABLES

Put the variables in order by a property of their dictionary entries.

Syntax

SORT VARIABLES [BY] NAME | TYPE | FORMAT | LABEL | VALUES | MISSING | MEASURE | ROLE | COLUMNS
               | ALIGNMENT | ATTRIBUTE name [(A | D)].
A or UP is ascending (the default), D or DOWN reverses the whole order.
NAME: letters without regard to case, then a number at the end by its value (v2 before v10).
TYPE: numeric, then strings from narrow to wide. FORMAT: by format type in the order of the
data file codes (A, COMMA, DOLLAR, F, ... DATE ...), then width and decimals.
LABEL, VALUES, MISSING, ATTRIBUTE: variables without one come first; then labels and
attribute values without regard to case; value labels and missing values so that equal
definitions sit together. MEASURE: nominal, ordinal, scale. ROLE: input, target, both, none,
partition, split. COLUMNS: display width (default 8 for numbers, the width for strings).
ALIGNMENT: left, right, center. Variables that tie keep their order.

Example

SORT VARIABLES BY NAME (A).

statscraft help SORT VARIABLES prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

RENAME VARIABLES

Change the names of variables.

Syntax

RENAME VARIABLES (oldlist = newlist) [(oldlist = newlist) ...].
RENAME VARIABLES old = new [old = new ...].
All renames happen at once, so (a b = b a) swaps two names. new1 TO new3 counts up.

Example

RENAME VARIABLES (q1 q2 = satisfaction recommend) (v1 TO v3 = item1 TO item3).

statscraft help RENAME VARIABLES prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

DELETE VARIABLES

Remove variables from the dataset.

Syntax

DELETE VARIABLES varlist.

Example

DELETE VARIABLES tmp1 tmp2 q7_1 TO q7_9.

statscraft help DELETE VARIABLES prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

WEIGHT

Weight the cases by a variable, or turn weighting off.

Syntax

WEIGHT BY var.
WEIGHT OFF.

Example

WEIGHT BY weight.

statscraft help WEIGHT prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

AGGREGATE

Aggregate groups of cases into new variables or a new dataset.

Syntax

AGGREGATE [/OUTFILE=* | 'path' | dataset [MODE=ADDVARIABLES | REPLACE]] [/BREAK=varlist [(A | D)] ...]
          /target ['label'] [target ...] = function(varlist) [/target ...].
OUTFILE=* replaces the active dataset with one case per break group (break variables, then
targets); with MODE=ADDVARIABLES it keeps the cases and adds the targets to each of them.
OUTFILE='path' writes the aggregated dataset to a file and leaves the active dataset alone;
OUTFILE=dataset puts it into a dataset that DATASET DECLARE or DATASET NAME defined.
Without OUTFILE the targets are added to every case, as with OUTFILE=* MODE=ADDVARIABLES.
functions: SUM MEAN SD MEDIAN MIN MAX FIRST LAST N NU NMISS NUMISS; N and NU also without (varlist).
Missing values are skipped. With a weight variable SUM, MEAN, SD, MEDIAN, N and NMISS are weighted.

Example

AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=region /region_mean = MEAN(income) /region_n = N.

statscraft help AGGREGATE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

VARSTOCASES

Turn groups of variables into cases: one new case per variable of the group.

Syntax

VARSTOCASES /MAKE new ['label'] [FROM] varlist [/MAKE ...]
            [/INDEX=i ['label'] | i ['label'] (make) | i ['label'] (n) j ['label'] (n) ...]
            [/ID=new ['label']] [/NULL=DROP | KEEP] [/COUNT=new ['label']]
            [/KEEP=ALL | varlist | /DROP=varlist].
Every case becomes one case per variable of the FROM lists, in their order; FROM lists
have equal lengths and one type each. A MAKE variable takes the dictionary of its first
FROM variable (strings their widest width), the label given replacing the label. The other
variables are copied to every new case (KEEP: only those, in that order). INDEX numbers the
new cases 1, 2, ...; with (make) it holds the names of that MAKE's FROM variables; with (n)
several factors whose levels multiply to the length of the lists, the last varying fastest.
ID is the case number of the original case (F8.0), COUNT the number of new cases it gave
(F4.0). NULL=DROP (the default) leaves out a new case whose MAKE values are all
system-missing or blank. Order of the new file: ID, the copied variables, COUNT, INDEX,
MAKE; ID and INDEX are nominal, COUNT scale. All cases are used whatever FILTER says;
WEIGHT, SPLIT FILE and FILTER stay unless their variables are gone. Not after TEMPORARY.

Example

VARSTOCASES /MAKE score 'Score' FROM score1 TO score4 /INDEX=wave /ID=person.

statscraft help VARSTOCASES prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

CASESTOVARS

Turn groups of cases into one case each, with a variable per value of an index.

Syntax

CASESTOVARS [/ID=varlist] [/INDEX=varlist] [/FIXED=varlist] [/AUTOFIX=YES | NO]
            [/VIND [ROOT=name]] [/COUNT=new ['label']] [/RENAME var=root ...]
            [/SEPARATOR='text'] [/GROUPBY=VARIABLE | INDEX] [/DROP=varlist].
A row group is a run of cases with the same values of the split and ID variables; the
data must be sorted by them. Cases with a system-missing or blank ID are left out with a
warning. Every other variable that varies within a group becomes a variable group: one
variable per index value (INDEX: the values or combinations that occur, ascending; without
INDEX the position in the group), named root, separator ('.') and the index values. With
one string index the values are the names (root, separator and value when several
variables are restructured); names that cannot be used become V1, V2, ... AUTOFIX=YES
copies variables that do not vary (one value plus system-missing or blanks counts as not
varying), and warns about FIXED variables that vary; AUTOFIX=NO makes such a FIXED
variable an error. New variables keep the dictionary of their source; the label adds the
index values. VIND adds a 0/1 indicator (F1.0) per index value, COUNT the cases of the
group (F4.0). Order: split, ID and fixed variables as in the file, the variable groups,
the indicators, COUNT. User-missing values count as values. All cases are used whatever
FILTER says; WEIGHT, SPLIT FILE and FILTER stay unless their variables are gone or
spread. Not after TEMPORARY.

Example

CASESTOVARS /ID=person /INDEX=wave /GROUPBY=VARIABLE.

statscraft help CASESTOVARS prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

FLIP

Transpose the data: variables become cases and cases become variables.

Syntax

FLIP [VARIABLES=ALL | varlist] [/NEWNAMES=var].
Each variable becomes a case, named in the new string variable CASE_LBL; each case becomes a
numeric variable (F8.2), named VAR001, VAR002, ... or by the values of NEWNAMES (the values
of CASE_LBL after an earlier FLIP). Names are upper case; a number gets K_ in front, as does a
name that does not start with a letter; other characters a name cannot hold become _, and a
repeated name gets _A, _B, ...; a missing or blank value keeps the default name. String
values and user-missing values become system-missing. Every case is transposed whatever
FILTER says. Labels, value labels, the weight, the split and the filter are gone.
Transformations before FLIP become permanent: TEMPORARY ends. A table lists the new names.

Example

FLIP VARIABLES=income price year /NEWNAMES=country.

statscraft help FLIP prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

SPLIT FILE

Run each procedure on every group of adjacent cases with the same values.

Syntax

SPLIT FILE [LAYERED | SEPARATE] BY varlist.
SPLIT FILE OFF.
A group ends where a split variable changes value, so sort the cases first.
LAYERED (the default) shows the groups in one table, with the split variables as the
outermost row labels; SEPARATE gives every group tables of its own. AGGREGATE ignores
the split; SORT CASES turns it off. The split is kept with the dataset.

Example

SPLIT FILE SEPARATE BY region.

statscraft help SPLIT FILE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

FILTER

Leave out of procedures the cases whose filter value is 0 or missing.

Syntax

FILTER BY var.
FILTER OFF.
The cases stay in the dataset. The filter is kept with the dataset, follows a rename
and ends when the variable is deleted or the dataset replaced.

Example

FILTER BY adult.

statscraft help FILTER prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

TEMPORARY

Make the changes that follow last only until the next procedure.

Syntax

TEMPORARY.
Transformations, labels, formats, SELECT IF, SAMPLE, N OF CASES, WEIGHT, FILTER and
SPLIT FILE after it are undone once the next command that reads the data (a procedure,
EXECUTE or SAVE) has run, or at the end of the run. Variables that procedure adds stay.

Example

TEMPORARY.

statscraft help TEMPORARY prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

N OF CASES

Keep only the first n cases from the next data pass on.

Syntax

N OF CASES n.
The limit applies after SELECT IF and SAMPLE, wherever they stand in the pass.

Example

N OF CASES 100.

statscraft help N OF CASES prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

N

Short for N OF CASES.

Syntax

N n.

Example

N 100.

statscraft help N prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

SAMPLE

Keep a random sample of the cases.

Syntax

SAMPLE proportion.
SAMPLE n FROM m.
A proportion between 0 and 1 keeps each case with that chance; n FROM m keeps exactly n
of the first m cases (fewer when there are fewer than m). Inside DO IF only the cases of
the branch are sampled. The random numbers come from the generator SET RNG chooses, started
by SET SEED or MTINDEX; a new session starts from the default seed.

Example

SAMPLE 500 FROM 3420.

statscraft help SAMPLE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

AUTORECODE

Recode values into consecutive integers in new variables, labelled with the old values.

Syntax

AUTORECODE [VARIABLES=] varlist /INTO newlist [/BLANK=VALID | MISSING] [/GROUP]
           [/DESCENDING] [/PRINT].
Valid values get 1, 2, ... in ascending order (DESCENDING: descending), user-missing values
the codes after them, still user-missing; system-missing stays missing. Each code is
labelled with the value label or the value. GROUP uses one scheme for all variables,
BLANK=MISSING makes a blank string user-missing. All cases are recoded, also those a
filter leaves out. APPLY TEMPLATE and SAVE TEMPLATE are not supported yet.

Example

AUTORECODE VARIABLES=country /INTO country_code /PRINT.

statscraft help AUTORECODE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

RANK

Ranks, percentile groups, proportion estimates, normal and Savage scores as new variables.

Syntax

RANK [VARIABLES=]varlist [(A | D)] [varlist [(A | D)] ...] [BY varlist]
     [/RANK] [/RFRACTION] [/PERCENT] [/PROPORTION] [/N] [/NTILES(k)] [/SAVAGE] [/NORMAL]
     [/TIES=MEAN | LOW | HIGH | CONDENSE] [/FRACTION=BLOM | RANKIT | TUKEY | VW]
     [/PRINT=YES | NO] [/MISSING=EXCLUDE | INCLUDE].
Each function, given at most once and followed by INTO names if wished, adds one new variable per
ranked variable; without any, RANK is done. A (ascending, the default) or D (the largest value first)
applies to the variables before it back to the previous A or D. BY ranks within each combination of
the BY values; a missing BY value forms a group of its own. With the sum of weights W: RFRACTION is
the rank r divided by W, PERCENT that times 100, N is W, NTILES(k) the group 1 to k, the integer part
of r k / (W + 1) plus 1. PROPORTION follows FRACTION: BLOM (r - 3/8) / (W + 1/4) (the default),
RANKIT (r - 1/2) / W, TUKEY (r - 1/3) / (W + 1/3), VW r / (W + 1); NORMAL is its standard normal
quantile and SAVAGE the exponential score. TIES gives tied values the mean (default), lowest or
highest rank; CONDENSE ranks the distinct values 1, 2, 3. A missing value (user-missing unless
INCLUDE) or a missing, zero or negative weight gives system-missing. Names after INTO are used in
order; the others are the function's first letter and the first seven characters of the name, then
the function's first three letters and 001, 002 when taken, then RNK, two letters and 01. Labels read
RANK of salary (by the BY variables). PRINT=NO leaves out the table of the new variables. Within
SPLIT FILE groups the ranks start over.

Example

RANK VARIABLES=salary (D) BY region /RANK /NTILES(4) INTO salary_q /TIES=LOW.

statscraft help RANK prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

COMPUTE

Assign the value of an expression to a variable.

Syntax

COMPUTE target = expression.

Example

COMPUTE bmi = weight / (height / 100) ** 2.

statscraft help COMPUTE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

IF

Assign a value only for the cases where a condition holds.

Syntax

IF (condition) target = expression.
The parentheses around the condition are optional.

Example

IF (age >= 65 AND region = 2) senior_south = 1.

statscraft help IF prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

SELECT IF

Keep only the cases where a condition holds.

Syntax

SELECT IF condition.

Example

SELECT IF age >= 18 AND NOT MISSING(q1).

statscraft help SELECT IF prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

RECODE

Map values of variables to new values.

Syntax

RECODE varlist (inputs = output) [(inputs = output) ...] [INTO newvars] [/ varlist ...].
inputs: values, low THRU high (with LOWEST or HIGHEST), MISSING, SYSMIS, ELSE.
output: a value, SYSMIS or COPY.
The first matching (inputs = output) wins. A value or range also matches user-missing values.
Without a match a variable keeps its value, and so does an existing INTO target; a new target becomes system-missing.
A string target of INTO must exist already. A quoted value longer than its variable is an error.

Example

RECODE age (LOWEST THRU 29 = 1) (30 THRU 59 = 2) (60 THRU HIGHEST = 3) INTO age_group.

statscraft help RECODE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

STRING

Declare new string variables, filled with empty strings.

Syntax

STRING names (Awidth) [/ names (Awidth) ...].
A string variable must exist before COMPUTE or IF can assign text to it.

Example

STRING full_name (A40) / code1 code2 (A8).

statscraft help STRING prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

NUMERIC

Declare new numeric variables, filled with system-missing.

Syntax

NUMERIC names [(format)] [/ names [(format)] ...].
Without a format the variables get F8.2.

Example

NUMERIC score1 score2 (F5.1) / flag.

statscraft help NUMERIC prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

DO IF

Start a block of transformations that run only where a condition holds.

Syntax

DO IF (condition).
Followed by COMPUTE, IF, RECODE or nested DO IF commands, then optional
ELSE IF (condition). and ELSE. branches, then END IF.
For each case the first branch whose condition is true runs. After a missing
condition no later branch runs for that case.

Example

DO IF (age < 18).

statscraft help DO IF prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

ELSE IF

Start the next conditional branch of a DO IF block.

Syntax

ELSE IF (condition).

Example

ELSE IF (age < 65).

statscraft help ELSE IF prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

ELSE

Start the branch of a DO IF block for the cases no condition matched.

Syntax

ELSE.

Example

ELSE.

statscraft help ELSE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

END IF

End a DO IF block.

Syntax

END IF.

Example

END IF.

statscraft help END IF prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

DO REPEAT

Repeat transformations with stand-in names replaced by variables or values.

Syntax

DO REPEAT standin = varlist | values [/ standin = varlist | values ...].
  transformation commands
END REPEAT [PRINT].
Every list must have as many items; the commands run once per item, each stand-in
replaced by its item. A list holds existing variables (TO in file order, ALL) or new
names (v1 TO v5), or numbers and quoted strings (1 TO 5 counts up). PRINT shows the
generated commands.

Example

DO REPEAT r = region1 TO region5 / v = 1 TO 5.
COMPUTE r = (region = v).
END REPEAT.

statscraft help DO REPEAT prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

LOOP

Repeat transformations for each case, with an index, a condition or both.

Syntax

LOOP [var = first TO last [BY step]] [IF condition].
  transformation commands
END LOOP [IF condition].
The index runs from first to last by step (1 by default); the expressions may differ
per case, a missing one skips the loop. IF on LOOP is checked before each iteration,
IF on END LOOP after it. A loop without an index stops after SET MXLOOPS iterations
(default 40). BREAK leaves the innermost loop.

Example

LOOP #i = 1 TO 5.
COMPUTE total = total + #i.
END LOOP.

statscraft help LOOP prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

END LOOP

End a LOOP, optionally when a condition holds.

Syntax

END LOOP [IF condition].

Example

LOOP.
COMPUTE x = x + 1.
END LOOP IF x >= 10.

statscraft help END LOOP prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

BREAK

Leave the innermost LOOP, usually inside DO IF.

Syntax

BREAK.

Example

LOOP #i = 1 TO 10.
DO IF v(#i) = 0.
BREAK.
END IF.
END LOOP.

statscraft help BREAK prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

VECTOR

Name a range of variables, or new variables, as a vector for indexed use.

Syntax

VECTOR name = first TO last [/ ...].
VECTOR prefix [, prefix ...] (n [format]) [/ ...].
The first form refers to existing variables, all numeric or all strings of one width;
the second creates prefix1 to prefixn (F8.2, or the format given). v(i) reads an element
in expressions and is a target of COMPUTE and IF. A vector lasts until the next procedure.

Example

VECTOR q = q1 TO q10 / new (5, F2).

statscraft help VECTOR prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

CTABLES

Custom tables: counts, percentages and statistics by categories.

Syntax

CTABLES [/FORMAT EMPTY=ZERO|BLANK|'text' MISSING='text']
        [/VLABELS VARIABLES=varlist DISPLAY=DEFAULT|NAME|LABEL|BOTH|NONE]
        [/MRSETS COUNTDUPLICATES=NO|YES]
        [/HIDESMALLCOUNTS [COUNT=5]] [/WEIGHT VARIABLE=varname] [/SMISSING VARIABLE|LISTWISE]
        [/PCOMPUTE &name=EXPR(expression)]
        [/PPROPERTIES &name ... [LABEL='text'] [FORMAT=function format ...] [HIDESOURCECATS=NO|YES]]
        /TABLE [rows] [BY [columns] [BY layers]]
        [/SLABELS POSITION=COLUMN|ROW|LAYER VISIBLE=YES|NO]
        [/CLABELS AUTO|ROWLABELS=OPPOSITE|LAYER|COLLABELS=OPPOSITE|LAYER] [/CRITERIA CILEVEL=95]
        [/CATEGORIES VARIABLES=varlist [ORDER=A|D] [KEY=VALUE|LABEL|function[(var[, n])]]
                     [MISSING=EXCLUDE|INCLUDE]
                     [TOTAL=NO|YES] [LABEL='text'] [POSITION=AFTER|BEFORE] [EMPTY=INCLUDE|EXCLUDE]]
        [/CATEGORIES VARIABLES=varlist [value, low THRU high, OTHERNM, MISSING, &name,
                     SUBTOTAL='label', HSUBTOTAL='label', ...] [TOTAL=YES ...]]
        [/TITLES TITLE='text' ['text' ...] CAPTION='text' ... CORNER='text' ...]
        [/SIGTEST TYPE=CHISQUARE [ALPHA=0.05] [INCLUDEMRSETS=YES|NO] [CATEGORIES=ALLVISIBLE|SUBTOTALS]]
        [/COMPARETEST TYPE=PROP|MEAN [ALPHA=0.05 [0.01]] [ADJUST=BONFERRONI|BH|NONE]
                      [MEANSVARIANCE=ALLCATS|TESTEDCATS] [SHOWSIG=NO|YES] [INCLUDEMRSETS=YES|NO]
                      [CATEGORIES=ALLVISIBLE|SUBTOTALS] [MERGE=NO|YES [STYLE=APA|SIMPLE]]
                      [ORIGIN=COLUMN]]
        [/TABLE ... another table with its own SLABELS, CATEGORIES, TITLES and tests].
rows, columns: variables joined by + (stack) and > (nest), with parentheses. var [C] or var [S]
makes a variable categorical or scale; otherwise SCALE is scale and the other levels categorical.
A numeric variable of unknown level is scale with a currency, date or time format, a fraction, a
negative value, 24 or more distinct values, or no value below 10; else categorical.
/TABLE BY columns leaves the rows empty: one row without a label. Layers (rows BY columns BY
layers, or rows BY BY layers) give a table for every layer category,
for every combination of nested layer variables and every category of stacked ones; its title
names the layer. Within a layer the percentages are of that layer (LAYERPCT: of all its cells;
LAYERROWPCT and LAYERCOLPCT: across its subtables), except TABLEPCT, which spans all layers.
SLABELS POSITION=LAYER makes every summary a layer of its own. Tests run in every layer.
A summary list follows a scale variable or the innermost categorical variable of one axis:
var [function ['label'] [format], ...], such as PCT8.1. Formats: F, PCT, COMMA, DOT (period and
comma swapped), DOLLAR, N (leading zeros), E (scientific), and NEGPAREN (negative numbers in
parentheses), NEQUAL (N= before), PAREN (in parentheses), PCTPAREN (percent in parentheses);
these four show the number as F in the width and add their marks outside it; CCA to CCE and
the date and time formats. By default a summary of a scale variable has the variable's format,
but for dates: STDDEV, SEMEAN and RANGE as days and time (DTIME), SUM and VARIANCE plain;
and VARIANCE of a time variable plain. A function given
twice in a list is two columns, each with its own format.
After a parenthesis, (a + b > c) [COUNT], the summaries go to a and c, before their own ones.
TITLES: several quoted texts are several lines. )DATE in them is today's date (YYYY-MM-DD),
)TIME the time (HH:MM:SS), both local; )TABLE the table expression without levels and
summaries, with variable and set labels in place of names: Gender > Age BY Region.
TOTALS [function ...] inside the list gives the totals and subtotals of that categorical
variable their own summaries (the columns hold both lists); a function of scale variables there,
such as MEAN or MEDIAN, summarizes the variable's own values: var [COUNT TOTALS [MEAN]].
CLABELS ROWLABELS=OPPOSITE moves the categories of the innermost row variables to the columns,
inside the column categories and outside the summary labels, and COLLABELS=OPPOSITE the other
way; the moved variable counts as the innermost one of its new axis, also for percentages.
ROWLABELS=LAYER or COLLABELS=LAYER makes a layer of every category instead; the moved variable
then counts as a layer variable.
Stacked variables whose labels move need the same categories with the same labels; tests are
not available then.
Default: COUNT for categorical tables, MEAN for a scale variable.
Categorical: COUNT, ROWPCT, COLPCT, TABLEPCT, SUBTABLEPCT, LAYERPCT, LAYERROWPCT, LAYERCOLPCT,
each with .COUNT, .VALIDN or .TOTALN (COLPCT.COUNT and so on); COLPCT alone means COLPCT.COUNT.
Scale: also MEAN MEDIAN MODE MINIMUM MAXIMUM RANGE SUM STDDEV VARIANCE SEMEAN PTILE n VALIDN TOTALN
MISSING and the percentages with .SUM. A U prefix (UCOUNT, UMEAN) ignores the weight.
SMISSING LISTWISE: a case missing on one scale variable of a table is missing on all of them
(a table: the sections with the same categorical variables); it still counts in COUNT and TOTALN.
Confidence limits and standard errors: a .LCL, .UCL or .SE suffix (COUNT.LCL, COLPCT.COUNT.UCL,
MEAN.SE); .LCL and .UCL for COUNT, the percentages of COUNT, VALIDN or TOTALN, MEAN, MEDIAN, PTILE
and SUM, .SE for COUNT, those percentages, MEAN and SUM; not for sets or with a U prefix.
CRITERIA CILEVEL (after its /TABLE, default 95) sets the level. A proportion has the Jeffreys
interval (Beta quantiles of w + 0.5 and W - w + 0.5, weights rounded); a count is the table's
weight times the interval of its share of the table; a mean or sum the t interval; a percentile
the percentiles at the limits of the share at or below it.
/WEIGHT VARIABLE=var (before the first /TABLE) weights every table by an effective base weight,
in place of the WEIGHT command's variable. ECOUNT (also for categorical variables and sets),
EVALIDN and ETOTALN are then the effective bases (sum of weights)^2 / (sum of squared weights)
of COUNT, VALIDN and TOTALN, and SEMEAN uses the variance adjusted to the effective base;
without /WEIGHT they equal COUNT, VALIDN and TOTALN. The tests then round nothing: the
chi-square is multiplied by the subtable's weight over its sum of squared weights, and the
column tests are t-tests on the effective bases, comparing two categories when both have a
case and one of them two.
Weighted by the weight variable when one is set; fractional weights are not rounded, and a case
whose weight is zero, negative or missing is left out (also from U functions). MEDIAN and PTILE
use the averaged empirical distribution. A count without cases is 0 unless EMPTY says otherwise.
A total has percentages too: the base of a total row or column takes in every category totaled.
In an explicit list OTHERNM stands for every valid value the list does not name, in ascending
order, and MISSING for every user-missing value; a value named twice takes its last place.
KEY=function sorts the categories of a list without explicit values by that summary of each,
taken over all cases of the category whatever the other variables (COUNT, or MEAN(age),
PTILE(age, 75) for a variable); ORDER=D sorts from the largest, and ties keep value order.
SUBTOTAL='label' in an explicit list sums the listed categories before it, back to the previous
subtotal (with POSITION=BEFORE the ones after it, up to the next); HSUBTOTAL also hides them.
A subtotal counts a case once, like a total, and has every summary and percentage a total has.
A computed category &name stands in an explicit category list of a categorical variable. For
every summary its value is EXPR over the same summary of other categories: [value], [low THRU
high] (the sum of the listed categories in the range), TOTAL (needs TOTAL=YES), numbers, + - * /
** and parentheses, SUBTOTAL (the only subtotal) or SUBTOTAL[n] (the nth), [OTHERNM] and
[MISSING] (the sums of those categories). Every category it names must be listed. PPROPERTIES gives its label (else
the expression; )LABEL[n] in it is the label of the nth item of the list as written, a range as
'low THRU high'), a format per summary, and HIDESOURCECATS=YES to hide the categories it uses
(not with tests). Totals and tests leave computed categories out.
HIDESMALLCOUNTS COUNT=n (n a whole number from 2, default 5) shows every COUNT, VALIDN, TOTALN or
RESPONSES below n, weighted or with U, as <n in all tables of the command.
User-missing categories are left out unless MISSING=INCLUDE; system-missing ones always are.
A case whose missing value is left out still counts in TOTALN and the .TOTALN percentages; a
case whose valid value an explicit category list leaves out is not in the table at all.
Tests run in every innermost subtable (innermost row by innermost column variable, for each
category of the outer ones), each in a table after the main one. SIGTEST: Pearson chi-square; empty
rows and columns are left out. Tests compare the shown categories, with an HSUBTOTAL in place of
the categories it hides; CATEGORIES=SUBTOTALS puts every subtotal in place of its categories.
COMPARETEST: two-sided pairwise z-tests of column proportions (PROP)
or t-tests of column means (MEAN: a scale variable with MEAN in the rows) in every row of a subtable.
The letter of the column with the smaller value appears in the column with the larger one: uppercase
below the smaller ALPHA, lowercase below the larger; a period marks a column left out (a proportion
of 0 or 1, or less than 2 cases). ADJUST defaults to BONFERRONI, MEANSVARIANCE to ALLCATS. With a
weight variable the tests round the weighted cell counts, column totals or category weights.
MERGE=YES puts the letters in the main table instead, in a column after each compared category
(in the row of MEAN, or of COLPCT or COUNT, when the summaries are in the rows). STYLE=APA (the
default) gives letters that two columns share unless they differ significantly at the smaller
ALPHA; STYLE=SIMPLE gives the keys of the separate table. SHOWSIG=YES keeps the separate table.
A multiple response set ($name, see MRSETS) stands where a categorical variable may. A case counts
once in every category it has a response in; the set's total counts the cases with any response.
A dichotomy set lists its variables in set order; /CATEGORIES may list them by name: [q5_3, q5_1].
A set may carry the summaries even with categorical variables nested inside it; of two nested sets
only the inner one may. Sets also have RESPONSES and, for every percentage base above,
base.RESPONSES (responses over the area's responses), base.RESPONSES.COUNT (responses over the
area's count) and base.COUNT.RESPONSES (count over the area's responses). A case without any
response counts only in TOTALN and the .TOTALN percentages. COUNTDUPLICATES=YES counts a value that
a case gives in two variables of a category set twice in the responses; counts never do.
Tests on sets (INCLUDEMRSETS=YES, the default) count each case once in the margins and allow for the
cases two categories of a set share; the means test then pools the variance from the two categories
compared. INCLUDEMRSETS=NO leaves sets out of the tests, and so does COUNTDUPLICATES=YES for a
category set.

Example

CTABLES /TABLE q1 [COUNT, COLPCT.COUNT PCT8.1] BY gender /CATEGORIES VARIABLES=q1 TOTAL=YES.

statscraft help CTABLES prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

MRSETS

Define, delete and list multiple response sets.

Syntax

MRSETS [/]MDGROUP NAME=$name [LABEL='text' | LABELSOURCE=VARLABEL] [CATEGORYLABELS=VARLABELS | COUNTEDVALUES]
       VARIABLES=varlist VALUE=value
       /MCGROUP NAME=$name [LABEL='text'] VARIABLES=varlist
       /DELETE NAME=[$name ...] | ALL
       /DISPLAY NAME=[$name ...] | ALL.
Subcommands run in the order written and may repeat. A set name starts with $; defining an
existing name replaces that set. A set has at least two variables, all numeric or all strings.
MDGROUP (dichotomies): every variable is one category, labelled with its variable label or name; a
case has a response in it when the variable holds VALUE, a whole number or, for strings, a quoted
text no wider than the narrowest variable. CATEGORYLABELS=COUNTEDVALUES labels each category with
the value label of VALUE in its variable instead; every variable needs one and they must differ.
LABELSOURCE=VARLABEL (only with COUNTEDVALUES, instead of LABEL) takes the set label from the first
variable of the set that has a variable label, else the name of the first variable.
MCGROUP (categories): the values of the variables are
the categories, labelled with the value labels of the first variable that has one.
DISPLAY lists the sets in a table. Sets are saved with the data file and used by CTABLES.

Example

MRSETS /MDGROUP NAME=$channels LABEL='Contact channels' VARIABLES=q5_1 TO q5_5 VALUE=1 /DISPLAY NAME=ALL.

statscraft help MRSETS prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

DESCRIPTIVES

Summary statistics of numeric variables, optionally saved as z-scores.

Syntax

DESCRIPTIVES [/]VARIABLES=varlist [/STATISTICS=stat ...] [/MISSING=VARIABLE | LISTWISE [INCLUDE]] [/SAVE].
stat: MEAN SEMEAN STDDEV VARIANCE KURTOSIS SKEWNESS RANGE MINIMUM MAXIMUM SUM DEFAULT ALL.
DEFAULT is MEAN STDDEV MINIMUM MAXIMUM; N is always shown. Weighted when a weight variable is set.
MISSING=VARIABLE (the default) leaves out the missing values of each variable on its own;
LISTWISE leaves out a case missing on any listed variable; INCLUDE counts user-missing values.
The row Valid N (listwise) counts the cases valid on every listed variable. String variables get no
statistics; a warning names them. var (name) in the list adds a z-score under that name; SAVE adds
one for every variable, named Z plus the variable name (ZSC001 to ZSC099, STDZ01 to STDZ09,
ZZZZ01 to ZZZZ09, ZQZQ01 to ZQZQ09 when that name is taken), labelled Zscore: plus the label.

Example

DESCRIPTIVES VARIABLES=age income (z_inc) /STATISTICS=DEFAULT SUM /SAVE.

statscraft help DESCRIPTIVES prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

CROSSTABS

Contingency tables with percentages, residuals and chi-square tests.

Syntax

CROSSTABS [/]TABLES=rowvars BY colvars [BY layervars ...] [/TABLES=...]
          [/CELLS=COUNT ROW COLUMN TOTAL EXPECTED RESID SRESID ASRESID ALL NONE]
          [/STATISTICS=CHISQ] [/MISSING=TABLE | INCLUDE]
          [/FORMAT=AVALUE | DVALUE TABLES | NOTABLES]
          [/COUNT=[ASIS | CASE | CELL] [ROUND | TRUNCATE]].
One table per pair of row and column variable; layer variables split it into blocks.
NOTABLES leaves out the tables, as CELLS=NONE does, keeping the statistics.
COUNT makes weighted counts whole: CASE every case's weight, CELL every cell's count, before
anything is computed; ROUND or TRUNCATE. A keyword left out is CELL or ROUND; without COUNT,
ASIS, weights stay as they are.
CELLS defaults to COUNT; CELLS alone is COUNT ROW COLUMN TOTAL. Percentages are 0 to 100.
STATISTICS alone is CHISQ. DVALUE orders the rows from the highest value; columns stay ascending.
CHISQ: Pearson, likelihood ratio, linear-by-linear (numeric variables), and for a 2 x 2
table Fisher's exact test and the continuity correction.
MISSING=TABLE leaves out a case missing on any variable of the table; INCLUDE keeps
user-missing values as categories. Fisher's test takes whole counts: rounded, or truncated with TRUNCATE.

Example

CROSSTABS /TABLES=region BY gender /CELLS=COUNT ROW /STATISTICS=CHISQ.

statscraft help CROSSTABS prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

MULT RESPONSE

Frequency tables and crosstabulations of multiple response groups and variables.

Syntax

MULT RESPONSE [/]GROUPS=name ['label'] (varlist (value)) | (varlist (min, max)) [name ...]
              [/VARIABLES=varlist (min, max) [varlist (min, max) ...]]
              [/FREQUENCIES=items]
              [/TABLES=items BY items [BY items ...] [(PAIRED)] [/items BY ...]]
              [/MISSING=[TABLE | MDGROUP | MRGROUP] [INCLUDE]]
              [/FORMAT=[LABELS | NOLABELS] [TABLE | CONDENSE | ONEPAGE] [DOUBLE]]
              [/BASE=CASES | RESPONSES] [/CELLS=[COUNT] [ROW] [COLUMN] [TOTAL] [ALL]].
GROUPS, VARIABLES, FREQUENCIES and TABLES come in this order, before the others; at least
one of GROUPS and VARIABLES and one of FREQUENCIES and TABLES. One value makes a dichotomy
group (its categories are the variables with that value), two a category group (the values
from min to max, counted over all its variables). Groups exist only in this command.
items: groups, and variables named on VARIABLES; TO follows their order there. Values are
truncated to whole numbers; values out of range do not count. Empty categories are left out.
A case is missing for a group with no counted value; MDGROUP and MRGROUP leave out a case
missing on any variable of a dichotomy or category group (MRGROUP also for a value out of
range); INCLUDE counts user-missing values. FREQUENCIES: responses, percent of responses
and percent of cases. TABLES: counts, and the percentages CELLS asks for (ALL without
keywords), based on cases or with BASE=RESPONSES on responses. PAIRED pairs the first
variable of a category group with the first of another, and so on; its percentages are
based on responses. NOLABELS and CONDENSE show values for category groups and variables;
ONEPAGE and DOUBLE only change printed layout and are ignored with a warning. Weights count
as they are.

Example

MULT RESPONSE GROUPS=media 'Media used' (tv radio web (1))
brands 'Brands known' (brand1 TO brand3 (1, 9))
/VARIABLES=gender (1, 2)
/FREQUENCIES=media brands
/TABLES=media brands BY gender
/CELLS=COLUMN.

statscraft help MULT RESPONSE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

MEANS

Statistics of dependent variables within groups of control variables.

Syntax

MEANS [TABLES=]deps [BY controls [BY ...]] [/deps BY ...] [/CELLS=cell ...]
      [/STATISTICS=ANOVA | LINEARITY | NONE] [/MISSING=TABLE | INCLUDE | DEPENDENT].
cell: MEAN COUNT STDDEV MEDIAN GMEDIAN SEMEAN SUM MIN MAX RANGE VARIANCE KURT SEKURT SKEW
SESKEW FIRST LAST NPCT SPCT NPCT(var) SPCT(var) HARMONIC GEOMETRIC DEFAULT ALL; DEFAULT is MEAN
COUNT STDDEV. GMEDIAN is the grouped median: each value is the midpoint of its interval.
NPCT(var) and SPCT(var) give the percent of the N and of the sum of the cases in the same
category of var, which must be a control of every table list (all cases on its Total rows).
One Report table per dependent and combination of controls: every group of the first control,
the next nested inside, each level with a Total. A Case Processing Summary per table list.
A string dependent gets COUNT, FIRST and LAST only. ANOVA gives the analysis of variance by the
first control with eta; LINEARITY adds the linear term and r (three or more numeric groups).
Without /MISSING each dependent with its controls leaves out its own missing cases; any /MISSING
leaves out cases missing on any variable of the list (INCLUDE: user-missing values count;
DEPENDENT: they count for the controls only). Weighted when a weight variable is set.

Example

MEANS TABLES=income BY region BY gender /CELLS=MEAN COUNT STDDEV MEDIAN /STATISTICS=ANOVA.

statscraft help MEANS prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

T-TEST

One-sample, independent-samples and paired-samples t tests with effect sizes.

Syntax

T-TEST /TESTVAL=value /VARIABLES=varlist
T-TEST /GROUPS=var[(value) | (value, value)] /VARIABLES=varlist
T-TEST /PAIRS=varlist [WITH varlist [(PAIRED)]] [/varlist ...]
       [/CRITERIA=CI(0.95)] [/MISSING=ANALYSIS | LISTWISE [INCLUDE]]
       [/ES DISPLAY(TRUE | FALSE) STANDARDIZER(SD | CORRECTED_SD | AVERAGE)].
GROUPS without values compares 1 with 2; one value splits at it (at or above against below).
The independent test shows Levene's test and rows for equal and unequal variances. PAIRS without
WITH pairs every variable with every later one; WITH pairs each left with each right one, and
(PAIRED) the n-th with the n-th. ANALYSIS (default) leaves out cases missing in each analysis,
LISTWISE those missing on any variable of the test type. Effect sizes: Cohen's d and Hedges'
correction (and Glass's delta for groups) with confidence intervals; they use weights rounded to
whole numbers. Weighted when a weight variable is set.

Example

T-TEST GROUPS=gender(1,2) /VARIABLES=age income /CRITERIA=CI(.90).

statscraft help T-TEST prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

ONEWAY

One-way analysis of variance with contrasts and post hoc comparisons.

Syntax

ONEWAY deps BY factor [/STATISTICS=DESCRIPTIVES HOMOGENEITY WELCH BROWNFORSYTHE ALL NONE]
       [/CONTRAST=coefficients] [/POSTHOC=test ... [ALPHA(0.05)]]
       [/MISSING=ANALYSIS | LISTWISE [INCLUDE | EXCLUDE]] [/CRITERIA=CILEVEL(0.95)].
test: LSD BONFERRONI SIDAK TUKEY SCHEFFE GT2 GABRIEL GH T2 T3 C (pairwise comparisons),
DUNNETT DUNNETTL DUNNETTR [(refcat)] (each group against the reference group, by default the last;
L: smaller, R: larger), SNK BTUKEY DUNCAN FREGW QREGW (homogeneous subsets only); TUKEY SCHEFFE
GT2 GABRIEL give both. DUNCAN and the Dunnett keywords are written in full. Every value of the
factor is a group. CONTRAST gives one coefficient per group in ascending order (n*c repeats c n
times); it is tested with pooled and separate variances. HOMOGENEITY is Levene's test based on
the mean. Multiple Comparisons show every ordered pair of groups (Dunnett C has no significance).
Homogeneous subsets use the harmonic mean of the group sizes (the R-E-G-W tests the sizes
themselves); Tukey B shows no significance. Weighted when a weight variable is set.
Not supported yet: POLYNOMIAL, RANGES, EFFECTS, WALLER.

Example

ONEWAY income BY region /STATISTICS=DESCRIPTIVES HOMOGENEITY WELCH /POSTHOC=TUKEY GH.

statscraft help ONEWAY prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

CORRELATIONS

Pearson correlations with significance and case counts.

Syntax

CORRELATIONS [/VARIABLES=]varlist [WITH varlist] [/varlist ...]
             [/PRINT=TWOTAIL | ONETAIL  SIG | NOSIG  FULL | LOWER | LNODIAG]
             [/STATISTICS=DESCRIPTIVES XPROD ALL] [/MISSING=PAIRWISE | LISTWISE [INCLUDE]].
A list alone gives a square matrix, WITH a rectangular one (left variables in rows). NOSIG marks
coefficients significant at 0.05 with * and at 0.01 with **. XPROD adds cross-products and
covariances; DESCRIPTIVES a table of means, standard deviations and counts. PAIRWISE (default)
uses the cases valid on both variables of a pair; LISTWISE the cases valid on every variable
of every list. Weighted when a weight variable is set.

Example

CORRELATIONS /VARIABLES=age income WITH satisfaction /PRINT=ONETAIL NOSIG.

statscraft help CORRELATIONS prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

NONPAR CORR

Spearman’s rho and Kendall’s tau-b rank correlations with significance.

Syntax

NONPAR CORR [/VARIABLES=]varlist [WITH varlist] [/varlist ...]
            [/PRINT=SPEARMAN | KENDALL | BOTH  TWOTAIL | ONETAIL  SIG | NOSIG
                    FULL | LOWER | LNODIAG] [/MISSING=PAIRWISE | LISTWISE [INCLUDE]] [/SAMPLE].
A list alone gives a square matrix, WITH a rectangular one (left variables in rows). Ties get
their average rank; rho is tested with t on N - 2 df, tau-b with the normal approximation and
the tie-corrected variance. NOSIG marks coefficients significant at 0.05 with * and at 0.01
with **. PAIRWISE (default) uses the cases valid on both variables of a pair; LISTWISE the
cases valid on every variable of the list, each list on its own. A weight variable repeats
each case as often as its weight rounded to a whole number. SAMPLE changes nothing.
Not supported yet: MATRIX, CI.

Example

NONPAR CORR /VARIABLES=satisfaction recommend WITH age /PRINT=BOTH NOSIG.

statscraft help NONPAR CORR prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

PARTIAL CORR

Partial correlations of variables controlling for others, with significance.

Syntax

PARTIAL CORR [VARIABLES=]varlist [WITH varlist] BY controls [(order ...)] [/...]
             [/SIGNIFICANCE=TWOTAIL | ONETAIL] [/STATISTICS=NONE CORR DESCRIPTIVES BADCORR ALL]
             [/FORMAT=MATRIX | CONDENSED | SERIAL] [/MISSING=LISTWISE | ANALYSIS  EXCLUDE | INCLUDE].
A list alone gives a square matrix, WITH a rectangular one. Without orders the partials control
for every control variable at once; an order k gives one block per set of k controls (up to five
orders, 25 lists). Coefficients come from the zero-order Pearson correlations step by step, and are
tested with t on M - k - 2 df, M the smallest weighted count of the correlations used. A coefficient
that cannot be computed is empty. CORR shows the zero-order correlations first, BADCORR only when one
of them is empty; DESCRIPTIVES the mean, standard deviation and N. CONDENSED shows the coefficients
alone, marked * at 0.05 and ** at 0.01; SERIAL shows each pair once. LISTWISE (default) uses the cases
valid on every variable of the list, controls included; ANALYSIS each pair's valid cases. Weighted
when a weight variable is set. Not supported yet: MATRIX.

Example

PARTIAL CORR /VARIABLES=satisfaction recommend BY age /STATISTICS=CORR /SIGNIFICANCE=ONETAIL.

statscraft help PARTIAL CORR prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

NPAR TESTS

Nonparametric tests: one-sample, two and k related samples, two and k independent samples.

Syntax

NPAR TESTS [/CHISQUARE=varlist [(lo,hi)] [/EXPECTED=EQUAL | f1, n*f2, ...]]
           [/BINOMIAL[(p)]=varlist[(cut) | (value1,value2)]] [/RUNS(MEAN | MEDIAN | MODE | value)=varlist]
           [/K-S(NORMAL [mean,sd] | UNIFORM [min,max] | POISSON [mean] | EXPONENTIAL [mean])=varlist]
           [/WILCOXON | /SIGN | /MCNEMAR | /MH=varlist [WITH varlist [(PAIRED)]]]
           [/FRIEDMAN | /KENDALL | /COCHRAN=varlist]
           [/M-W | /K-S | /W-W | /MOSES[(n)] | /K-W | /J-T | /MEDIAN[(value)]=varlist BY var(value1,value2)]
           [/STATISTICS=[DESCRIPTIVES] [QUARTILES] [ALL]] [/MISSING=ANALYSIS | LISTWISE [INCLUDE]]
           [/METHOD=EXACT [TIMER(n)] | MC [CIN(n)] [SAMPLES(n)]] [/SAMPLE] [/KS_SIM ...].
Long names work too: CHI-SQUARE, KOLMOGOROV-SMIRNOV, MANN-WHITNEY, WALD-WOLFOWITZ, KRUSKAL-WALLIS,
JONCKHEERE-TERPSTRA. Without WITH every variable is paired with every later one; (PAIRED) pairs the
n-th with the n-th. M-W, two-sample K-S, W-W and MOSES compare the two groups (MOSES: the first is the
control group); K-W and J-T take every value from value1 to value2 as a group; MEDIAN does so when
value1 < value2, and compares the two values otherwise. Exact significance where the method gives it
for small samples: binomial; sign and McNemar up to 25 changes; Mann-Whitney when n1 n2 <= 400 and
n1 n2 / 2 + min(n1, n2) <= 220; median test up to 30 cases (Fisher); W-W up to 30 cases; Moses.
K-S with normal parameters taken from the data uses the Lilliefors significance. METHOD adds exact
significances for Wilcoxon, sign, McNemar, Mann-Whitney and the runs tests (MC gives them too, as
exact results replace simulated ones); other tests stay asymptotic, with a warning. ANALYSIS (default)
leaves out cases missing on a test's variables, LISTWISE cases missing on any variable of the command.
A weight repeats each case as often as its weight rounded to a whole number. SAMPLE and KS_SIM change
nothing.

Example

NPAR TESTS /M-W=income BY gender(1,2) /WILCOXON=before WITH after /STATISTICS=QUARTILES.

statscraft help NPAR TESTS prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

EXAMINE

Descriptives, percentiles, M-estimators, extreme values and normality tests, by factor cells.

Syntax

EXAMINE [VARIABLES=]deps [BY factor [BY factor] [factor ...]] [/TOTAL | NOTOTAL] [/ID=var]
        [/PERCENTILES[(list)][=HAVERAGE | WAVERAGE | ROUND | EMPIRICAL | AEMPIRICAL | NONE]]
        [/STATISTICS=DESCRIPTIVES EXTREME[(n)] ALL NONE] [/CINTERVAL=95]
        [/MESTIMATORS[=HUBER[(c)] TUKEY[(c)] HAMPEL[(a,b,c)] ANDREW[(c)] ALL NONE]]
        [/PLOT=[BOXPLOT] [STEMLEAF] [HISTOGRAM] [NPPLOT] | ALL | NONE] [/COMPARE=GROUPS | VARIABLES]
        [/MISSING=LISTWISE | PAIRWISE  EXCLUDE | INCLUDE  NOREPORT | REPORT].
Each dependent is analysed over all cases (unless NOTOTAL) and in every cell of each factor term,
two factors crossed with BY. Descriptives (the default): mean with its confidence interval (CINTERVAL,
50 to 99.99), 5% trimmed mean, median, variance, standard deviation, minimum, maximum, range,
interquartile range, skewness and kurtosis with standard errors. PERCENTILES alone gives 5 10 25 50
75 90 95 by HAVERAGE, with Tukey's hinges when 25, 50 or 75 is listed; the method also gives the median
and the interquartile range. MESTIMATORS alone gives all four (Huber 1.339, Tukey 4.685, Hampel
1.7 3.4 8.5, Andrews 1.34 times pi), each started at the median and scaled by the median absolute
deviation. EXTREME lists the n highest and lowest values by case number or by the ID variable.
NPPLOT gives the Tests of Normality table (Kolmogorov-Smirnov with the Lilliefors significance and
Shapiro-Wilk by Royston's algorithm, 3 to 5000 cases); the plots themselves are not drawn.
LISTWISE (default) leaves out a case missing on any dependent or factor, PAIRWISE only from the
analyses of that variable. INCLUDE makes user-missing values of the dependents valid, REPORT makes
missing values of the factors categories. Weighted when a weight variable is set (Shapiro-Wilk rounds
the weights and takes 3 to 50 cases with non-integer weights). COMPARE changes nothing.
BOXPLOT, STEMLEAF and HISTOGRAM are accepted and not drawn yet, with a warning; the
statistics are shown. ALL is the three and NPPLOT. Not supported yet: SPREADLEVEL.

Example

EXAMINE VARIABLES=income BY region /PERCENTILES(25,50,75)=HAVERAGE /STATISTICS=ALL /MESTIMATORS /PLOT=NPPLOT.

statscraft help EXAMINE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

REGRESSION

Linear regression with forced entry or removal and stepwise selection, residuals and diagnostics.

Syntax

REGRESSION [/VARIABLES=varlist | (COLLECT)] [/DESCRIPTIVES=[DEFAULTS MEAN STDDEV VARIANCE CORR SIG
           BADCORR COV XPROD N ALL NONE]] [/MISSING=LISTWISE | PAIRWISE | MEANSUBSTITUTION [INCLUDE]]
           [/REGWGT=var] [/STATISTICS=[DEFAULTS R ANOVA COEFF OUTS ZPP CHANGE CI[(95)] BCOV COLLIN TOL
           F SES XTX SELECTION LABEL ALL]] [/CRITERIA=[DEFAULTS PIN[(0.05)] | FIN[(3.84)] POUT[(0.10)] |
           FOUT[(2.71)] TOLERANCE[(0.0001)] MAXSTEPS(n) CIN[(95)]]] [/ORIGIN | NOORIGIN]
           /DEPENDENT=varlist /[METHOD=]ENTER [varlist] | REMOVE varlist | STEPWISE [varlist] |
           FORWARD [varlist] | BACKWARD [varlist] [/METHOD=...]
           [/RESIDUALS=[DEFAULTS DURBIN OUTLIERS(tempvars) ID(var) HISTOGRAM NORMPROB]]
           [/CASEWISE=[DEFAULTS OUTLIERS(3) | ALL PLOT(tempvar) DEPENDENT tempvars]]
           [/SAVE=tempvar[(name)] ... [FITS]] [/SCATTERPLOT ...] [/PARTIALPLOT ...].
tempvar: PRED RESID ZPRED ZRESID SRESID DRESID SDRESID ADJPRED SEPRED MAHAL COOK LEVER DFBETA SDBETA
DFFIT SDFIT COVRATIO MCIN ICIN. One equation per dependent; each METHOD works on the equation the
ones before it left, and each step is a model. ENTER takes the variables in order of tolerance;
STEPWISE removes the weakest variable while its F-to-remove fails POUT, then enters the strongest
that passes PIN; FORWARD only enters, BACKWARD only removes (entering its list first when the
equation is empty). A variable enters only when it and the variables in the equation keep the
TOLERANCE. Without keywords STATISTICS is R ANOVA COEFF OUTS and DESCRIPTIVES is MEAN STDDEV CORR.
The tables: Variables Entered/Removed, Model Summary (CHANGE, DURBIN, SELECTION add columns),
ANOVA, Coefficients (CI, ZPP, TOL, COLLIN, SES, F add columns), Excluded Variables, Coefficient
Correlations (BCOV), Collinearity Diagnostics (COLLIN), the swept correlation matrix (XTX),
Residuals Statistics (with RESIDUALS, CASEWISE or a plot), Casewise Diagnostics and Outlier
Statistics. LISTWISE (default) uses the cases valid on every variable; PAIRWISE builds the
correlations pair by pair, with the smallest pair count as N; MEANSUBSTITUTION puts the mean in
place of a missing value. SAVE adds variables named PRE_1, RES_1 and so on, or as given; DFBETA and
SDBETA save one per coefficient (name0, name1, ...), MCIN and ICIN a lower and an upper bound.
Weighted when a weight variable is set; REGWGT gives weighted least squares. HISTOGRAM, NORMPROB,
SCATTERPLOT, PARTIALPLOT and TEMPLATE are accepted with a warning that charts are not drawn yet.
LABEL changes nothing. Not supported yet: METHOD=TEST, SELECT, MATRIX, OUTFILE.

Example

REGRESSION /STATISTICS=COEFF OUTS R ANOVA CHANGE /DEPENDENT=spend /METHOD=ENTER age /METHOD=STEPWISE q1 TO q5 /SAVE=PRED ZRESID.

statscraft help REGRESSION prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

RELIABILITY

Reliability of a scale: Cronbach’s alpha, split-half and other models, item statistics and ICC.

Syntax

RELIABILITY /VARIABLES=varlist [/SCALE(label)=varlist | ALL]
            [/MODEL=ALPHA | SPLIT[(n)] | GUTTMAN | PARALLEL | STRICTPARALLEL]
            [/STATISTICS=DESCRIPTIVE SCALE CORR COV ANOVA [FRIEDMAN | COCHRAN] TUKEY HOTELLING ALL]
            [/SUMMARY=MEANS VARIANCE COV CORR TOTAL ALL]
            [/ICC=[MODEL(MIXED | RANDOM | ONEWAY)] [TYPE(CONSISTENCY | ABSOLUTE)] [CIN=95] [TESTVAL=0]]
            [/METHOD=COVARIANCE] [/MISSING=EXCLUDE | INCLUDE].
A case missing on any variable of VARIABLES is left out. ALPHA (default) gives Cronbach's alpha
and the alpha of the standardized items; SPLIT puts n items (default half, the odd one in the
first part) in the second part and gives the alpha of each part, the correlation between them,
Spearman-Brown and Guttman's split-half; GUTTMAN gives lambda 1 to 6; PARALLEL and STRICTPARALLEL
give the maximum likelihood estimates and a chi-square test of the model. SUMMARY TOTAL is the
Item-Total Statistics: scale mean, variance and alpha if the item is deleted and the corrected
item-total correlation. ANOVA is the repeated measures table; FRIEDMAN (with Kendall's W) and
COCHRAN give their chi-square in place of F, computed from the values as they are (give ranks
or 0/1 items); TUKEY adds the test for nonadditivity; HOTELLING tests that the item means are
equal. ICC gives single and average measure coefficients with confidence intervals and F tests.
Items without variance are dropped, with a warning, when the model or a statistic needs the
covariance matrix (all but ALPHA and SPLIT with DESCRIPTIVE, SCALE, ANOVA and TOTAL).
Weighted when a weight variable is set. Not supported yet: MODEL=OMEGA, MATRIX.

Example

RELIABILITY /VARIABLES=q1 TO q10 /SCALE('Satisfaction') ALL /MODEL=ALPHA /STATISTICS=DESCRIPTIVE SCALE /SUMMARY=TOTAL.

statscraft help RELIABILITY prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

FACTOR

Factor analysis: principal components and six factoring methods, rotations, factor scores.

Syntax

FACTOR VARIABLES=varlist | MATRIX=IN(COR=* | 'file' | COV=* | 'file')
       [/MISSING=[LISTWISE | PAIRWISE | MEANSUB] [INCLUDE]] [/SELECT=var(value)]
       [/ANALYSIS=varlist] [/METHOD=CORRELATION]
       [/PRINT=[DEFAULT] [INITIAL] [EXTRACTION] [ROTATION] [UNIVARIATE] [CORRELATION] [COVARIANCE]
               [SIG] [DET] [INV] [REPR] [AIC] [KMO] [FSCORE] [ALL]]
       [/FORMAT=[SORT] [BLANK(n)] [DEFAULT]] [/DIAGONAL=values | DEFAULT] [/PLOT=...]
       [/CRITERIA=[FACTORS(n)] [MINEIGEN(1)] [ITERATE(25)] [ECONVERGE(.001)] [RCONVERGE(.0001)]
                  [KAISER | NOKAISER] [DELTA(0)] [KAPPA(4)] [DEFAULT]]
       [/EXTRACTION=PC | PAF | ALPHA | IMAGE | ULS | GLS | ML]
       [/ROTATION=VARIMAX | EQUAMAX | QUARTIMAX | OBLIMIN[(delta)] | PROMAX[(kappa)] | NOROTATE]
       [/SAVE=[REG | BART | AR] [(n | ALL [rootname])]].
The analysis is of the correlation matrix of the ANALYSIS variables (default all of VARIABLES).
LISTWISE (default) uses the cases valid on every variable of VARIABLES; PAIRWISE each pair's own
cases; MEANSUB puts the mean in place of a missing value. SELECT computes the matrix from the
cases with that value, while scores are saved for all cases. CRITERIA applies to the EXTRACTION
and ROTATION that follow it. The number of factors is FACTORS(n), else the count of eigenvalues
above MINEIGEN. Without EXTRACTION the extraction is PC with VARIMAX; with EXTRACTION but no
ROTATION the factors are not rotated. A later ANALYSIS cancels the PRINT, DIAGONAL, EXTRACTION,
ROTATION and SAVE before it, with a warning. Tables: Descriptive Statistics (UNIVARIATE),
Correlation Matrix (CORRELATION, SIG, DET), Inverse of Correlation Matrix (INV), Covariance Matrix,
KMO and Bartlett's Test (KMO), Anti-image Matrices (AIC), Communalities, Total Variance Explained,
Component or Factor Matrix, Goodness-of-fit Test (ML, GLS), Reproduced Correlations (REPR), the
rotated matrix with its transformation matrix, or Pattern, Structure and factor correlation
matrices for OBLIMIN and PROMAX, Score Coefficient and Score Covariance Matrix (FSCORE). SORT
orders the variables by the factor of their largest loading; BLANK(n) leaves out loadings below
n in absolute value. SAVE adds scores by regression, Bartlett or Anderson-Rubin, named FAC1_1,
FAC2_1 and so on, or rootname1, rootname2. MATRIX=IN reads a matrix file (ROWTYPE_ N, MEAN,
STDDEV, CORR or COV, VARNAME_) from the active dataset or a file. Weighted when a weight variable
is set. PLOT is accepted with a warning that charts are not drawn yet. Not supported yet:
METHOD=COVARIANCE, MATRIX=OUT, MATRIX=IN(FAC=...).

Example

FACTOR VARIABLES=q1 TO q10 /PRINT=INITIAL EXTRACTION ROTATION KMO /FORMAT=SORT BLANK(.3) /CRITERIA=MINEIGEN(1) /EXTRACTION=PC /ROTATION=VARIMAX /SAVE=REG(ALL).

statscraft help FACTOR prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

QUICK CLUSTER

K-means clustering of cases into a given number of clusters.

Syntax

QUICK CLUSTER varlist | ALL [/MISSING=[LISTWISE | PAIRWISE | DEFAULT] [INCLUDE]]
              [/FILE='file' | dataset] [/INITIAL=(values)]
              [/CRITERIA=[CLUSTER(2)] [NOINITIAL] [MXITER(10)] [CONVERGE(0)]]
              [/METHOD=KMEANS[(NOUPDATE | UPDATE)] | CLASSIFY]
              [/PRINT=[INITIAL] [CLUSTER] [ID(var)] [DISTANCE] [ANOVA] [NONE]]
              [/OUTFILE='file' | dataset] [/SAVE=[CLUSTER[(name)]] [DISTANCE[(name)]]].
Distances are Euclidean. Initial centers: by default the first k complete cases, then a case
replaces a center when it lies farther from the centers than the two closest centers lie from
each other (NOINITIAL keeps the first k cases); INITIAL gives them cluster by cluster, FILE reads
them from the clustering variables of a data file. KMEANS moves each center to the mean of its
cases after each pass (UPDATE after each case) until no center moves more than CONVERGE times the
smallest distance between the initial centers, or MXITER passes; CLASSIFY keeps the initial
centers. Then every case goes to its nearest center, and the final centers are the means of
their cases. Tables: Initial Cluster Centers, Iteration History, Cluster Membership (CLUSTER,
with ID), Final Cluster Centers, Distances between Final Cluster Centers (DISTANCE), ANOVA and
Number of Cases in each Cluster. LISTWISE (default) leaves out a case missing on any variable;
PAIRWISE uses the variables a case has. SAVE adds the cluster number and the distance to the
classification center, named QCL_1, QCL_2 and so on unless given. OUTFILE writes the final
centers with CLUSTER_. Weighted when a weight variable is set.

Example

QUICK CLUSTER q1 TO q5 /CRITERIA=CLUSTER(3) MXITER(20) /PRINT=INITIAL ANOVA /SAVE=CLUSTER(segment) DISTANCE.

statscraft help QUICK CLUSTER prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

CLUSTER

Hierarchical clustering of cases by one of 37 proximity measures and seven methods.

Syntax

CLUSTER varlist | /MATRIX=IN('file' | dataset | *)
        [/MEASURE=SEUCLID | EUCLID | COSINE | CORRELATION | BLOCK | CHEBYCHEV | MINKOWSKI(p) |
                  POWER(p,r) | CHISQ | PH2 | binary[(p[,np])]]
        [/METHOD=BAVERAGE | WAVERAGE | SINGLE | COMPLETE | CENTROID | MEDIAN | WARD [(rootname)] ...]
        [/PRINT=[SCHEDULE] [CLUSTER(min[,max])] [DISTANCE] [NONE]] [/SAVE=CLUSTER(min[,max])]
        [/ID=var] [/MISSING=EXCLUDE | INCLUDE] [/PLOT=[VICICLE | HICICLE[(min,max,inc)]] [DENDROGRAM] [NONE]].
binary: RR SM JACCARD DICE SS1 RT SS2 K1 SS3 K2 SS4 HAMANN OCHIAI SS5 PHI LAMBDA D Y Q BEUCLID SIZE
PATTERN BSEUCLID BSHAPE DISPER VARIANCE BLWMN, from the 2 x 2 table of presence (p, default 1) and
absence (np, default 0; with p alone every other value is absence). The items are the cases valid on
every variable; the weight variable is not used. Each step joins the most similar pair of clusters
(smallest distance or largest similarity) into the lower-numbered one and updates the proximities by
the formula of the method; BAVERAGE (default) and WAVERAGE choose by the mean proximity between or
within the clusters. Tables: Case Processing Summary, Proximity Matrix (DISTANCE), and for each
method the Agglomeration Schedule (default; for WARD the coefficient is the within-cluster sum of
squares) and Cluster Membership (CLUSTER), the clusters of a solution numbered in the order of their
first case. ID labels the cases. SAVE adds the membership of each solution, named rootname plus the
number of clusters, or CLUn_m. MATRIX=IN reads the rows of type PROX of a matrix file, a dissimilarity
matrix unless the value label of PROX says SIMILARITY. PLOT is accepted with a warning that charts
are not drawn yet. Not supported yet: MATRIX=OUT, SAVE with MATRIX=IN.

Example

CLUSTER q1 TO q5 /MEASURE=SEUCLID /METHOD=WARD /PRINT=SCHEDULE CLUSTER(2,4) /SAVE=CLUSTER(3).

statscraft help CLUSTER prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

DISCRIMINANT

Linear discriminant analysis with direct or stepwise entry and classification of cases.

Syntax

DISCRIMINANT GROUPS=var(min,max) /VARIABLES=varlist [/SELECT=var(value)]
   [/ANALYSIS=varlist[(level)] ...] [/METHOD=DIRECT | WILKS | MAHAL | MAXMINF | MINRESID | RAO]
   [/TOLERANCE=0.001] [/MAXSTEPS=n] [/FIN=3.84] [/FOUT=2.71] [/PIN=p] [/POUT=p] [/VIN=0]
   [/FUNCTIONS=n1[,pct[,sig]]] [/PRIORS=EQUAL | SIZE | values] [/SAVE=[CLASS[=name]] [SCORES[=root]] [PROBS[=root]]]
   [/ANALYSIS=... another block] [/MISSING=EXCLUDE | INCLUDE] [/HISTORY=STEP | NONE]
   [/CLASSIFY=[NONMISSING | UNSELECTED | UNCLASSIFIED] [POOLED | SEPARATE] [MEANSUB]]
   [/STATISTICS=[MEAN] [STDDEV] [UNIVF] [COV] [CORR] [FPAIR] [BOXM] [GCOV] [TCOV] [RAW] [COEFF] [TABLE]
                [CROSSVALID] [ALL]] [/ROTATE=NONE] [/PLOT=...].
The analysis uses the cases with a whole group value in the range, no missing value on VARIABLES and,
with SELECT, the selected value; groups without cases are ignored. DIRECT enters the variables that
pass the tolerance; the stepwise methods enter the variable with the best criterion (smallest Wilks'
lambda, largest smallest Mahalanobis distance or F between groups, smallest sum of unexplained
variation, largest increase in Rao's V) among those passing FIN or PIN, higher inclusion levels
first (even levels together, level 0 never), and remove a level 1 variable below FOUT or above POUT.
Tables: Analysis Case Processing Summary, Group Statistics, Tests of Equality of Group Means (UNIVF),
Pooled Within-Groups Matrices (COV, CORR), Covariance Matrices (GCOV, TCOV), Log Determinants and Box's
M (BOXM), the stepwise tables (HISTORY), Pairwise Group Comparisons (FPAIR), Eigenvalues, Wilks'
Lambda, Standardized Canonical Discriminant Function Coefficients, Structure Matrix, Canonical
Discriminant Function Coefficients (RAW), Functions at Group Centroids, Classification Processing
Summary, Prior Probabilities for Groups, Classification Function Coefficients (COEFF) and
Classification Results (TABLE, CROSSVALID leaving each case out). SAVE adds the predicted group, the
function scores and the posterior probabilities, named DSC_m and DSCn_m unless given. Weighted when a
weight variable is set. PLOT is accepted with a warning that it is not produced yet. Not supported
yet: ROTATE=COEFF and STRUCTURE, MATRIX, OUTFILE.

Example

DISCRIMINANT GROUPS=segment(1,3) /VARIABLES=q1 TO q6 /METHOD=WILKS /PRIORS=SIZE /STATISTICS=MEAN STDDEV UNIVF BOXM TABLE /SAVE=CLASS SCORES PROBS.

statscraft help DISCRIMINANT prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

LOGISTIC REGRESSION

Binary logistic regression with categorical covariates, stepwise selection and case diagnostics.

Syntax

LOGISTIC REGRESSION [VARIABLES=] dependent [WITH var | var BY var ...]
   [/CATEGORICAL=varlist] [/CONTRAST(var)=INDICATOR[(ref)] | DEVIATION[(ref)] | SIMPLE[(ref)] |
   DIFFERENCE | HELMERT | REPEATED | POLYNOMIAL[(metric)] | SPECIAL(matrix)]
   [/METHOD=ENTER | FSTEP[(COND | LR | WALD)] | BSTEP[(COND | LR | WALD)] [ALL | terms]] ...
   [/ORIGIN | NOORIGIN] [/ID=var] [/PRINT=[DEFAULT] [SUMMARY] [CORR] [ITER[(n)]] [GOODFIT] [CI(95)] [ALL]]
   [/CRITERIA=[BCON(0.001)] [ITERATE(20)] [LCON(0)] [PIN(0.05)] [POUT(0.10)] [EPS(1E-8)] [CUT(0.5)]]
   [/MISSING=EXCLUDE | INCLUDE] [/CASEWISE=[tempvars] [OUTLIER(2)]]
   [/SAVE=tempvar[(name)] ...] [/CLASSPLOT] [/EXTERNAL].
tempvar: PRED PGROUP RESID DEV LRESID SRESID ZRESID LEVER COOK DFBETA. The dependent variable has
exactly two values among the cases used: the lower is coded 0 and the higher 1 (strings in
alphabetical order). A case missing on any variable is left out; one missing only on the dependent
still gets PRED and PGROUP. String covariates are categorical; a categorical variable with k
values becomes k - 1 coded variables that enter and leave together (INDICATOR, last category as
reference, by default). The fit is Newton-Raphson from all coefficients 0 and stops when no
coefficient changes by BCON or more, the -2 log likelihood changes by less than LCON percent, or
after ITERATE iterations. Each METHOD starts from the model the one before it left: ENTER enters
its terms, FSTEP enters by the score test (PIN) and removes by the chosen statistic (POUT), BSTEP
enters its terms first and then removes and enters the same way. Tables: Case Processing Summary,
Dependent Variable Encoding, Categorical Variables Codings, then for block 0 and each block the
Classification Table, Variables in the Equation, Variables not in the Equation, Omnibus Tests of
Model Coefficients, Model Summary (-2LL, Cox and Snell and Nagelkerke R square), Model if Term
Removed (LR), and with PRINT the Iteration History, Hosmer and Lemeshow Test with its contingency
table, the Correlation Matrix and the intervals of Exp(B). SUMMARY shows the last step of each
block only. CASEWISE lists every case, or those whose studentized residual is OUTLIER or more
away from 0. SAVE adds PRE_1, PGR_1, RES_1, DEV_1, LRE_1, SRE_1, ZRE_1, LEV_1, COO_1 and DFB0_1,
DFB1_1, ... (one per coefficient), or the names given (DFBETA(name) gives name0, name1, ...).
Weighted when a weight variable is set. CLASSPLOT is accepted with a warning that charts are not
drawn yet; EXTERNAL changes nothing. Not supported yet: SELECT, OUTFILE.

Example

LOGISTIC REGRESSION VARIABLES=bought WITH age income region /CATEGORICAL=region /METHOD=FSTEP(LR) /PRINT=GOODFIT CI(95) /SAVE=PRED.

statscraft help LOGISTIC REGRESSION prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

UNIANOVA

General linear model of one dependent variable: factorial ANOVA, ANCOVA and regression.

Syntax

UNIANOVA dependent [BY factors] [WITH covariates]
   [/WSFACTOR=name levels [POLYNOMIAL | contrast] ...] [/WSDESIGN=effects] (GLM)
   [/METHOD=SSTYPE(1 | 2 | 3 | 4)] [/INTERCEPT=INCLUDE | EXCLUDE] [/MISSING=EXCLUDE | INCLUDE]
   [/CRITERIA=[EPS(1E-8)] [ALPHA(0.05)]] [/REGWGT=var]
   [/PRINT=[DESCRIPTIVE] [HOMOGENEITY] [PARAMETER] [ETASQ] [OPOWER] [LOF]]
   [/EMMEANS=TABLES(OVERALL | factor[*factor...]) [WITH(covariate=value | MEAN ...)]
             [COMPARE[(factor)] [ADJ(LSD | BONFERRONI | SIDAK)]]] ...
   [/POSTHOC=factor ... (tests)] ... [/CONTRAST(factor)=DEVIATION[(ref)] | SIMPLE[(ref)] |
   DIFFERENCE | HELMERT | REPEATED | POLYNOMIAL[(metric)]] ...
   [/LMATRIX=['label'] effect coefficients ... [; ...] | ALL coefficients] ... [/KMATRIX=values]
   [/SAVE=tempvar[(name)] ...] [/PLOT=...] [/DESIGN=effects].
effects: INTERCEPT, a factor or covariate, a*b or a BY b, a(b) or a WITHIN b, a(b(c)), x*x, x*a.
tempvar: PRED WPRED RESID WRESID DRESID ZRESID SRESID SEPRED COOK LEVER. tests: as in ONEWAY
/POSTHOC (LSD BONFERRONI SIDAK TUKEY SCHEFFE GH T2 SNK BTUKEY DUNCAN GT2 GABRIEL FREGW QREGW T3 C
DUNNETT DUNNETTL DUNNETTR). Without DESIGN the model is the intercept, the covariates and the full
factorial of the factors. A case missing on any variable is left out; the weight is rounded to a
whole number. The design matrix has one column per effect level (only combinations that occur);
sweeping it gives a generalized inverse, and a column that adds nothing (EPS) is redundant, its
parameter 0. Tables: Between-Subjects Factors, Descriptive Statistics, Levene's Test of Equality
of Error Variances (absolute residuals by cell; based on the mean, the median, the median with
adjusted df and the trimmed mean for a full factorial without covariates), Tests of
Between-Subjects Effects (Type I sequential, II, III or IV sums of squares, with partial eta
squared, noncentrality and observed power), Parameter Estimates, Lack of Fit Tests, Contrast
Results and Test Results for each CONTRAST and LMATRIX, Estimated Marginal Means (cells weighted
equally, covariates at their means or the WITH values) with Pairwise Comparisons and Univariate
Tests, and the post hoc tables of ONEWAY on the observed means with the model's error. T2, T3,
GH and C need a model with one factor. SAVE adds PRE_1, RES_1 and so on, or the names given.
GLM with WSFACTOR: the dependents are the levels of the within-subjects factors (the first
factor's levels change slowest); Multivariate Tests, Mauchly's Test of Sphericity, Tests of
Within-Subjects Effects (sphericity assumed, Greenhouse-Geisser, Huynh-Feldt, lower bound), Tests
of Within-Subjects Contrasts and Tests of Between-Subjects Effects on the average.
PLOT is accepted with a warning that charts are not drawn yet. Not supported yet: GLM with several
dependents without WSFACTOR (the multivariate model), RANDOM, TEST, ROBUST, OUTFILE, MMATRIX,
MEASURE, POSTHOC VS, CONTRAST SPECIAL, PRINT GEF, TEST(LMATRIX), MBP, BP, F and WHITE; with
WSFACTOR also EMMEANS (left out with a warning), POSTHOC, CONTRAST, LMATRIX, SAVE and PRINT
PARAMETER, HOMOGENEITY and LOF.

Example

UNIANOVA score BY method school WITH pretest /PRINT=DESCRIPTIVE ETASQ PARAMETER /EMMEANS=TABLES(method) COMPARE ADJ(BONFERRONI) /DESIGN=pretest method school method*school.

statscraft help UNIANOVA prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

GLM

General linear model: one dependent variable as in UNIANOVA, or repeated measures with WSFACTOR.

Syntax

GLM dependent [BY factors] [WITH covariates]
   [/WSFACTOR=name levels [POLYNOMIAL | contrast] ...] [/WSDESIGN=effects] (GLM)
   [/METHOD=SSTYPE(1 | 2 | 3 | 4)] [/INTERCEPT=INCLUDE | EXCLUDE] [/MISSING=EXCLUDE | INCLUDE]
   [/CRITERIA=[EPS(1E-8)] [ALPHA(0.05)]] [/REGWGT=var]
   [/PRINT=[DESCRIPTIVE] [HOMOGENEITY] [PARAMETER] [ETASQ] [OPOWER] [LOF]]
   [/EMMEANS=TABLES(OVERALL | factor[*factor...]) [WITH(covariate=value | MEAN ...)]
             [COMPARE[(factor)] [ADJ(LSD | BONFERRONI | SIDAK)]]] ...
   [/POSTHOC=factor ... (tests)] ... [/CONTRAST(factor)=DEVIATION[(ref)] | SIMPLE[(ref)] |
   DIFFERENCE | HELMERT | REPEATED | POLYNOMIAL[(metric)]] ...
   [/LMATRIX=['label'] effect coefficients ... [; ...] | ALL coefficients] ... [/KMATRIX=values]
   [/SAVE=tempvar[(name)] ...] [/PLOT=...] [/DESIGN=effects].
effects: INTERCEPT, a factor or covariate, a*b or a BY b, a(b) or a WITHIN b, a(b(c)), x*x, x*a.
tempvar: PRED WPRED RESID WRESID DRESID ZRESID SRESID SEPRED COOK LEVER. tests: as in ONEWAY
/POSTHOC (LSD BONFERRONI SIDAK TUKEY SCHEFFE GH T2 SNK BTUKEY DUNCAN GT2 GABRIEL FREGW QREGW T3 C
DUNNETT DUNNETTL DUNNETTR). Without DESIGN the model is the intercept, the covariates and the full
factorial of the factors. A case missing on any variable is left out; the weight is rounded to a
whole number. The design matrix has one column per effect level (only combinations that occur);
sweeping it gives a generalized inverse, and a column that adds nothing (EPS) is redundant, its
parameter 0. Tables: Between-Subjects Factors, Descriptive Statistics, Levene's Test of Equality
of Error Variances (absolute residuals by cell; based on the mean, the median, the median with
adjusted df and the trimmed mean for a full factorial without covariates), Tests of
Between-Subjects Effects (Type I sequential, II, III or IV sums of squares, with partial eta
squared, noncentrality and observed power), Parameter Estimates, Lack of Fit Tests, Contrast
Results and Test Results for each CONTRAST and LMATRIX, Estimated Marginal Means (cells weighted
equally, covariates at their means or the WITH values) with Pairwise Comparisons and Univariate
Tests, and the post hoc tables of ONEWAY on the observed means with the model's error. T2, T3,
GH and C need a model with one factor. SAVE adds PRE_1, RES_1 and so on, or the names given.
GLM with WSFACTOR: the dependents are the levels of the within-subjects factors (the first
factor's levels change slowest); Multivariate Tests, Mauchly's Test of Sphericity, Tests of
Within-Subjects Effects (sphericity assumed, Greenhouse-Geisser, Huynh-Feldt, lower bound), Tests
of Within-Subjects Contrasts and Tests of Between-Subjects Effects on the average.
PLOT is accepted with a warning that charts are not drawn yet. Not supported yet: GLM with several
dependents without WSFACTOR (the multivariate model), RANDOM, TEST, ROBUST, OUTFILE, MMATRIX,
MEASURE, POSTHOC VS, CONTRAST SPECIAL, PRINT GEF, TEST(LMATRIX), MBP, BP, F and WHITE; with
WSFACTOR also EMMEANS (left out with a warning), POSTHOC, CONTRAST, LMATRIX, SAVE and PRINT
PARAMETER, HOMOGENEITY and LOF.

Example

GLM t1 t2 t3 BY group /WSFACTOR=time 3 POLYNOMIAL /WSDESIGN=time /DESIGN=group.

statscraft help GLM prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

ANOVA

Analysis of variance for factorial designs with covariates, the older form with MCA tables.

Syntax

ANOVA [VARIABLES=] dependents BY factors(min,max) [factors(min,max) ...] [WITH covariates] [/next list ...]
      [/COVARIATES=FIRST | WITH | AFTER] [/MAXORDERS=ALL | n | NONE]
      [/METHOD=UNIQUE | EXPERIMENTAL | HIERARCHICAL] [/STATISTICS=[MCA] [REG] [MEAN] [ALL] [NONE]]
      [/MISSING=EXCLUDE | INCLUDE].
A range follows the factors it applies to; factor values are truncated to whole numbers and cases
outside a range are left out, as is a case missing on any variable of its list. The model has the
covariates, the main effects and the interactions up to MAXORDERS (five by default); an order of
interactions with empty cells is dropped with a warning. UNIQUE (default) adjusts every effect for all
others (Type III); EXPERIMENTAL assesses covariates, main effects and each order of interactions in
turn, each adjusted for its own kind and the kinds before it; HIERARCHICAL adjusts each covariate and
factor only for those before it. COVARIATES sets where the covariates enter. Tables: ANOVA (with REG the
coefficients of the covariates where they enter), and, not with UNIQUE, Cell Means (MEAN), MCA,
Factor Summary and Model Goodness of Fit (MCA). STATISTICS without keywords is MEAN and REG. Weighted
when a weight variable is set.

Example

ANOVA VARIABLES=score BY region(1,4) sex(1,2) WITH age /METHOD=EXPERIMENTAL /STATISTICS=MEAN MCA.

statscraft help ANOVA prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

TREE

A classification tree grown by CHAID or exhaustive CHAID.

Syntax

TREE dependent [level] BY predictor [level] ... [FORCE = var [level]]
     [/TREE DISPLAY=TOPDOWN | LEFTTORIGHT | RIGHTTOLEFT | NONE  NODES=STATISTICS | CHART | BOTH
            BRANCHSTATISTICS=YES | NO  NODEDEFS=YES | NO  SCALE=AUTO | n]
     [/DEPCATEGORIES USEVALUES=[VALID MISSING value ...] TARGET=[value ...]]
     [/PRINT=MODELSUMMARY CLASSIFICATION RISK CPS TREETABLE | NONE]
     [/GAIN CATEGORYTABLE=YES | NO  TYPE=[NODE]  SORT=DESCENDING | ASCENDING  CUMULATIVE=YES | NO]
     [/SAVE NODEID[(name)] PREDVAL[(name)] PREDPROB[(root)]]
     [/METHOD TYPE=CHAID | EXHAUSTIVECHAID]  [/VALIDATION TYPE=NONE]
     [/GROWTHLIMIT MAXDEPTH=AUTO | n  MINPARENTSIZE=100  MINCHILDSIZE=50]
     [/CHAID ALPHASPLIT=.05 ALPHAMERGE=.05 SPLITMERGED=NO CHISQUARE=PEARSON | LR CONVERGE=.001
             MAXITERATIONS=100 ADJUST=BONFERRONI | NONE INTERVALS=10 | varlist(n) ...]
     [/COSTS EQUAL] [/SCORES EQUALINCREMENTS | CUSTOM=value [score] ...]
     [/MISSING NOMINALMISSING=MISSING | VALID].
Levels: [S] scale, [O] ordinal, [N] or [C] nominal; without one the dictionary's level holds,
and an unknown level comes from the data as in a data pass. The dependent is nominal
(Pearson or likelihood-ratio chi-square) or ordinal (likelihood ratio against Goodman's row
effects model, scored 1, 2, ... or by SCORES). Scale predictors are cut into INTERVALS groups of
about equal size. Predictor categories that do not differ at ALPHAMERGE are merged (ordinal ones
only when adjacent); a missing value is a category of its own that may merge with any. A category
smaller than MINCHILDSIZE is merged with its most similar neighbour. The predictor with the
smallest Bonferroni-adjusted significance splits the node when that is at most ALPHASPLIT. A node
is not split when it is pure, smaller than MINPARENTSIZE or at MAXDEPTH (AUTO is 3). Exhaustive
CHAID merges down to two categories and keeps the most significant set. The tree is shown as a
table with one row per node, indented by depth; charts are not drawn yet. TREETABLE lists the nodes
in order with their parents. Gain tables (one per TARGET category) show terminal nodes by index.
SAVE adds the terminal node, the predicted category and one probability per category for the
cases in the analysis (default names NodeID, PredictedValue, PredictedProbability_1, ...).
A weight counts each case as often as its rounded value. SPLIT FILE is ignored.
PLOT, PRIORS, CRT, QUEST, the settings of CRT and QUEST and PRINT IMPORTANCE, SURROGATES and
CATEGORYSPECS are accepted and ignored with a warning. Not supported
yet: METHOD TYPE=CRT and QUEST, a scale dependent, VALIDATION SPLITSAMPLE and CROSSVALIDATION,
SPLITMERGED=YES, COSTS CUSTOM, GAIN TYPE PTILE, RULES, PROFITS, INFLUENCE, OUTFILE, TARGETRESPONSE.

Example

TREE churn [n] BY region [n] age_group [o] income [s] /GROWTHLIMIT MAXDEPTH=2 /SAVE NODEID PREDVAL.

statscraft help TREE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

REPORT

Case listings and summary statistics by break groups, laid out as a report.

Syntax

REPORT [FORMAT=[MANUAL | AUTOMATIC] [NOLIST | LIST[(n)]] [ALIGN(LEFT | CENTER | RIGHT)] [TSPACE(1)]
        [CHDSPACE(1)] [FTSPACE(1)] [SUMSPACE(1)] [COLSPACE(4)] [BRKSPACE(n | -1)] [LENGTH(t,b)]
        [MARGINS(l,r)] [CHALIGN(TOP | BOTTOM)] [UNDERSCORE(ON | OFF)] [PAGE1(1)] [MISSING '.']
        [ONEBREAKCOLUMN ON | OFF] [INDENT(2)] [CHWRAP ON | OFF] [PREVIEW ON | OFF]]
   [/OUTFILE='path'] [/STRING=name (var [(width)] [(BLANK)] 'literal' ...) ...]
   /VARIABLES=var [(VALUE | LABEL | DUMMY)] [+ var ...] ['heading' ...] [(width)]
      [(OFFSET(n | CENTER))] [(LEFT | CENTER | RIGHT)] ...
   [/MISSING=VAR | NONE | LIST[([varlist] [n])]] [/TITLE=[LEFT | CENTER | RIGHT] 'line' ...]
   [/FOOTNOTE=[LEFT | CENTER | RIGHT] 'line' ...]
   [/BREAK=varlist | (TOTAL) ['heading' ...] [(width)] [(VALUE | LABEL)] [(TOTAL | NOTOTAL)]
      [(SKIP(1))] [(PAGE)] [(OFFSET(n | CENTER))] [(UNDERSCORE[(varlist)])] [(LEFT | CENTER | RIGHT)]
      [(NAME | NONAME)] [/SUMMARY=function ... ['title'] [(break column)] [SKIP(n)] | PREVIOUS[(n)]] ...] ...
functions: VALIDN SUM MIN MAX MEAN STDDEV (SD, STDEV) VARIANCE KURTOSIS SKEWNESS
MEDIAN(min,max) MODE(min,max) PGT(n) PLT(n) PIN(min,max) FREQUENCY(min,max) PERCENT(min,max),
each with an optional (var [(format | PLAIN)] [(decimals)] ...); composite functions
DIVIDE(a b [factor]) MULTIPLY PCT(a b) SUBTRACT(a b) ADD GREAT LEAST AVERAGE of aggregates
such as SUM(var) and numbers, with an optional (column [(format)] [(decimals)]).
The report is a table: a column for each BREAK (with ONEBREAKCOLUMN ON one for all, indented
by INDENT), then one for each report column, headed by its heading or the variable label or
name. LIST lists the cases, each value in its print format or with LABEL as its value label;
a stacked column lists each of its variables on a line of its own. A break group starts
when a value of its BREAK or an earlier one changes (sort the cases first): its values head
it, and its SUMMARY lines follow with their title (by default the function's) in the break
column. The statistics use the valid values and the weight; MISSING=NONE counts user-missing
values as valid, and MISSING=LIST leaves out the cases missing on n of the variables. MEDIAN,
MODE, FREQUENCY and PERCENT count the whole numbers of the range, cutting decimals off.
TOTAL on the first BREAK repeats its first SUMMARY for all cases at the end, under Grand
Total. Formats follow the manual's defaults for each function. TITLE and FOOTNOTE lines (by
default the text of the TITLE command) show above and below the report; )PAGE, )DATE and
)var in them give the page number, the date and the value label of the first case. OUTFILE
writes the report as text, with the column widths, spacing and alignment, instead of
showing it; a later REPORT of the same session appends to the file. The report is one
page, so LENGTH, PAGE and PREVIEW change nothing.

Example

SORT CASES BY dept.
REPORT FORMAT=LIST /VARIABLES=product (LABEL) sales 'Annual' 'Sales'
/BREAK=dept 'Department' (LABEL) /SUMMARY=VALIDN(product) MEAN(sales).

statscraft help REPORT prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

ADD FILES

Append the cases of several data files, matching variables by name.

Syntax

ADD FILES /FILE=* | 'path' | dataset [/RENAME=(old = new) ...] [/IN=var]
          /FILE=... [/RENAME=...] [/IN=var] [/BY varlist] [/FIRST=var] [/LAST=var]
          [/MAP] [/KEEP=varlist] [/DROP=varlist].
FILE=* is the active dataset; a dataset name (DATASET NAME), quoted or not, is that open
dataset and comes before a file of the same name. A variable missing from a file is blank in its cases.
The first file that has a variable gives its format and measurement level; a later file
fills in a label, value labels or missing values the earlier ones lack. A string variable
takes its widest width; a variable that is numeric in one file and a string in another is
an error. BY interleaves files sorted by the key variables.
RENAME and IN follow their FILE; BY, FIRST, LAST, MAP, KEEP and DROP follow every FILE.
IN adds a variable that is 1 for the cases from that file, else 0. FIRST and LAST (with
BY) add one that is 1 for the first or the last case of each key. These are F1.0 and go
at the end, IN first; KEEP and DROP cannot name them. MAP lists the variables of the
result at that point with their names in each file.
The result has the documents of every file. It stays weighted only when every file is
weighted by the same variable; otherwise a warning says so.

Example

ADD FILES /FILE=* /FILE='wave2.sav' /RENAME=(q1_new = q1) /DROP=tmp.

statscraft help ADD FILES prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

MATCH FILES

Combine the variables of several data files case by case or by key.

Syntax

MATCH FILES /FILE=* | 'path' | dataset [/RENAME=(old = new) ...] [/IN=var]
            [/TABLE='path' | dataset | * [/RENAME=...] [/IN=var] ...]
            /FILE=... [/BY varlist] [/FIRST=var] [/LAST=var]
            [/MAP] [/KEEP=varlist] [/DROP=varlist].
A dataset name (DATASET NAME), quoted or not, is that open dataset and comes before a file
of the same name.
With BY, cases with equal keys are joined; every file must be sorted by the keys (use
SORT CASES). Without BY the n-th cases of the files are joined. A TABLE adds its variables
to the cases whose key it holds and adds no cases; it may hold each key once. A variable in
several files takes its value from the first file that has the case.
RENAME and IN follow their FILE or TABLE; BY, FIRST, LAST, MAP, KEEP and DROP follow
every FILE and TABLE. IN (with BY) adds a variable that is 1 for the cases that file or
table has, else 0. FIRST and LAST (with BY) add one that is 1 for the first or the last
case of each key. These are F1.0 and go at the end, IN first; KEEP and DROP cannot name
them. MAP lists the variables of the result at that point with their names in each file.
The result has the documents of every file and keeps the weight when every weighted file
uses the same variable and KEEP or DROP leave it; otherwise a warning says so.

Example

MATCH FILES /FILE=* /TABLE='regions.sav' /BY region.

statscraft help MATCH FILES prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

STAR JOIN

Add the fields of lookup files to every case of a data file, by keys, as an SQL left join.

Syntax

STAR JOIN /SELECT * | alias.field [AS name], alias.field [AS name], ...
          /FROM 'path' [PASSWORD='text'] | dataset | * AS alias
          /JOIN 'path' [PASSWORD='text'] | dataset | * AS alias
                ON alias.key = alias.key [AND alias.key = alias.key ...] [IN=name]
          [/JOIN ...] /OUTFILE FILE='path' | dataset | *
          [/PASSPROTECT PASSWORD='text' | NONE [ENCRYPTEDPW=NO | YES]].
The subcommands come in this order and every keyword is written in full. A dataset
name, quoted or not, is that open dataset and comes before a file of the same name.
Every case of FROM is kept, in its order; a JOIN adds its fields to the cases whose keys
it holds and leaves them blank (system-missing, empty) elsewhere. The files need no
sorting, and each JOIN has its own keys. ON pairs a field of FROM with one of that JOIN,
numeric with numeric, string with string (widths may differ; trailing blanks do not
count). The keys of a JOIN must be unique there. A system-missing key matches nothing.
IN=name adds a variable that is 1 where the JOIN had the case and 0 where not.
The result holds the SELECT fields and every key: SELECT * is every field of every
source, and a JOIN key of the same name as its FROM key appears once, from FROM. Keys
not named on SELECT come first; the rest follow in SELECT order; IN variables last.
A name that two sources bring gets its alias in front (t1.name, t2.name) unless AS
names it. The dictionary comes from FROM (with its weight, filter and split); a key
without labels or missing values takes them from the first JOIN that has them; the
documents of every file are kept; the file label is dropped. Not after TEMPORARY.
OUTFILE=* replaces the active dataset, a dataset name (DATASET DECLARE) fills that
dataset, a path writes a data file. PASSWORD on FROM and JOIN is accepted for files that
are not encrypted (encrypted ones cannot be read); PASSPROTECT with a password is
refused for a file, since Statscraft writes no encrypted files, and ignored otherwise.

Example

STAR JOIN /SELECT t1.id, t1.region, t2.name /FROM * AS t1
/JOIN 'regions.sav' AS t2 ON t1.region = t2.region /OUTFILE FILE=*.

statscraft help STAR JOIN prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

UPDATE

Replace values of a primary file with the values of transaction files, by key.

Syntax

UPDATE FILE=* | 'path' | dataset [/RENAME=(old = new) ...] [/IN=var]
       /FILE=... [/RENAME=...] [/IN=var] [/FILE=...] /BY varlist
       [/MAP] [/KEEP=varlist] [/DROP=varlist].
The first FILE is the primary file, which may hold each key once; the others are
transactions. Every file must be sorted by the keys. A transaction value replaces the value
of the case with its key unless it is system-missing, user-missing or blank; transactions
apply in order, case by case and file by file. A key only a transaction has adds a case, a
variable only a transaction has adds a variable. Dictionaries combine as in MATCH FILES.
IN adds a variable at the end, 1 for the cases that file holds, else 0 (F1.0); KEEP and
DROP cannot name it. MAP lists the variables at that point with their names in each file.
There is no FIRST or LAST, since every key gives one case. The weight and the documents
follow MATCH FILES. FILE=* cannot follow TEMPORARY.

Example

UPDATE FILE='customers.sav' /FILE='changes.sav' /IN=changed /BY id.

statscraft help UPDATE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

DEFINE

Define a macro: a name that stands for syntax, with arguments.

Syntax

DEFINE name ([argument [/ argument ...]])
body
!ENDDEFINE.
argument: !POSITIONAL or keyword =, then one of !TOKENS(n), !CHAREND('c'),
!ENCLOSE('a', 'b'), !CMDEND, optionally with !DEFAULT(value) and !NOEXPAND (the value is
not scanned for macro calls when the expansion is).
DEFINE and !ENDDEFINE are written in full; the name may start with !.
A call is the macro name followed by its arguments, anywhere in a command outside quotes:
positional values first, in order, then keyword = value in any order. !TOKENS takes the
next n tokens, !CHAREND the tokens up to the character, !ENCLOSE the tokens between the two
characters, !CMDEND the rest of the command; the end of the command ends every argument,
and an argument left out gets its default or nothing. Tokens no argument takes stay in place.
In the body !1, !2 ... are the positional arguments, !* all of them, !name a keyword one.
Outside quotes the body is read in upper case.
Statements: !LET !var = expression; !IF (expression) !THEN ... [!ELSE ...] !IFEND;
!DO !var = from !TO to [!BY step] ... !DOEND; !DO !var !IN (list) ... !DOEND; !BREAK;
!OFFEXPAND and !ONEXPAND to stop and resume expanding macro calls.
Functions: !LENGTH(s) !CONCAT(s, ...) !SUBSTR(s, from[, length]) !INDEX(s, part) !HEAD(s)
!TAIL(s) !QUOTE(s) !UNQUOTE(s) !UPCASE(s) !BLANKS(n) !NULL !EVAL(s).
Expressions: = <> ~= < > <= >= (or !EQ !NE !LT !GT !LE !GE), !AND !OR !NOT (or & | ~),
parentheses. Operands are unquoted and compared as numbers when both are numbers, else as
text with case; the result is 1 or 0, and 0 is false.
The expansion is scanned again for macro calls, up to SET MNEST levels (50); a !DO loop
runs at most SET MITERATE times (1000). SET MEXPAND=OFF stops expansion and
SET MPRINT=YES shows every expanded command. A session (command line or window) keeps
the macros and these settings from run to run; DISPLAY MACROS lists the macros.
A body that ends with a period ends the command when the call is the last thing in it;
in the middle of a command that period is dropped.

Example

DEFINE !freqs (vars = !CMDEND) FREQUENCIES VARIABLES=!vars. !ENDDEFINE.

statscraft help DEFINE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

INSERT

Run the commands of another syntax file in place of this command.

Syntax

INSERT FILE='path' | handle [SYNTAX=INTERACTIVE | BATCH] [ERROR=CONTINUE | STOP] [CD=NO | YES]
       [ENCODING='name'] [PASSWORD='text'].
A relative path starts from the folder of the file that holds the INSERT, or from the
folder CD named. BATCH: a line that starts in the first column starts a new command, and
+ - or . there is ignored. CD=YES makes the folder of the file the folder for later
relative paths. ENCODING names the encoding of the file, such as 'windows-1257' or '1252';
by default UTF-8 when the file is valid UTF-8, else the system's legacy code page.
Files nest up to five levels; a file may not insert itself. ERROR and PASSWORD are
accepted and have no effect: a run stops at its first error.

Example

INSERT FILE='macros/tables.sps' CD=YES.

statscraft help INSERT prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

INCLUDE

Run the commands of another syntax file, read by the batch rules.

Syntax

INCLUDE [FILE=]'path' | handle [ENCODING='name'] [PASSWORD='text'].
Like INSERT SYNTAX=BATCH: a line that starts in the first column starts a new command.

Example

INCLUDE FILE='setup.sps'.

statscraft help INCLUDE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

BEGIN PROGRAM

A block of code in another programming language; it is skipped with a warning.

Syntax

BEGIN PROGRAM [language].
code
END PROGRAM.
Statscraft runs no Python or R code. The block is read up to END PROGRAM and not run;
the run goes on with one warning per block. Files, variables or commands the block would
make are missing, so later commands that need them fail.

Example

BEGIN PROGRAM PYTHON3.
print('not run')
END PROGRAM.

statscraft help BEGIN PROGRAM prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

SET

Change settings of the session.

Syntax

SET subcommand[=]value [[/] subcommand[=]value ...].
Followed: FORMAT=Fw.d (format of new numeric variables, default F8.2), DECIMAL=DOT | COMMA
(decimal mark when reading text data), MPRINT, MEXPAND, MNEST, MITERATE (see DEFINE),
LOCALE='name' (sets DECIMAL to the decimal mark of the locale: et_EE, de_DE give COMMA,
en_US, en_UK give DOT; OSLOCALE gives DOT; a later DECIMAL overrides it; files are always
Unicode, so a code page in the name changes nothing), UNICODE (Statscraft always works in
Unicode; OFF has no effect), PRINTBACK, CCA to CCE='negative
prefix,prefix,suffix,negative suffix' (custom currency formats; three commas, or three periods
when the decimal mark is a comma; ' before a period or comma makes it text), RNG=MC | MT
(the generator of random numbers), SEED=n | RANDOM (starts the MC generator again; a whole
number from 1 to 1999999999, default 2000000), MTINDEX=x | RANDOM (starts the MT generator,
the Mersenne Twister, again; any number, default 2000000). RANDOM takes the time of day.
MXLOOPS=n: the iterations of a LOOP without an index, and of every loop of MATRIX
(default 40). BLANKS=n | SYSMIS: the value of a completely blank numeric field read from
text (DATA LIST, GET DATA, NUMBER); it is not made a missing value. EPOCH=year | AUTOMATIC:
two-digit years in dates and the DATE. functions fall in the 100 years from that year
(AUTOMATIC: from 69 years before the current year). FUZZBITS=n (0 to 20, default 6): the
fuzzbits of RND and TRUNC without a third argument. SCALEMIN=n (default 24): a new numeric
variable read from text with at least n different values is scale. TVARS=NAMES | LABELS |
BOTH: variables in tables as names, labels (default; the name when there is no label) or
both, name then label ("q1 Satisfaction"). TNUMBERS=VALUES | LABELS | BOTH: values in
tables as values, value labels (default; the value when there is no label) or both, value
then label ("1 A great deal"). OVARS and ONUMBERS do the same for the titles of tables.
CTABLES /VLABELS and MULT RESPONSE /FORMAT=NOLABELS win over them. Settings for speed,
memory and messages (CACHE, THREADS, WORKSPACE, MXWARNS ...) are accepted and have nothing
to do. Settings that only change how output looks (TLOOK, WIDTH, LENGTH, DIGITGROUPING ...)
are accepted with a warning. YES and ON, NO and OFF are the same.

Example

SET FORMAT=F10.3 MPRINT=YES /DECIMAL=DOT TVARS=BOTH TNUMBERS=BOTH.

statscraft help SET prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

SHOW

Show the current settings.

Syntax

SHOW [ALL] [setting ...].
Any SET subcommand, and N, WEIGHT, FILTER, SPLIT, DIRECTORY, SYSMIS, VERSION, HANDLES (the file
handles), CC (CCA to CCE), ENVIRONMENT, LICENSE, $VARS, SCOMPRESSION, EXTPATHS, PLUGINS,
TMSRECORDING, EXTENSIONS and MXMEMORY. SEED shows where the MC generator stands.
A setting Statscraft does not follow shows what Statscraft uses, with a note in a Note column.
Without names: the main settings.

Example

SHOW FORMAT DECIMAL LOCALE.

statscraft help SHOW prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

PRESERVE

Store the current settings and folder, to bring them back with RESTORE.

Syntax

PRESERVE.
Stores every setting of SET (CCA to CCE, DECIMAL, FORMAT, LOCALE, MPRINT, MEXPAND, MNEST,
MITERATE and the rest) and the folder of CD. PRESERVE and RESTORE nest up to five levels.
A SET subcommand name after PRESERVE (PRESERVE LOCALE, as survey tools write it) is
accepted, since every setting is stored anyway; other words are ignored with a warning.

Example

PRESERVE.

statscraft help PRESERVE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

RESTORE

Bring back the settings and folder the last PRESERVE stored.

Syntax

RESTORE.
Every setting and the folder come back as the last PRESERVE stored them; a RESTORE without
PRESERVE does nothing, with a warning. After RESTORE LOCALE (or another SET subcommand name)
every setting still comes back; a warning names the settings besides LOCALE and DECIMAL that
changed after PRESERVE and so come back too. Other words are ignored with a warning.

Example

RESTORE.

statscraft help RESTORE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

CACHE

Accepted and has nothing to do: the data are always kept in memory.

Syntax

CACHE.

Example

CACHE.

statscraft help CACHE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

CD

Change the folder relative file names start from.

Syntax

CD 'folder' | handle.
A relative folder starts from the current one, which is the folder of the syntax file at
first. When the last part names no existing folder it is taken as a file name and left out.

Example

CD 'data/2026'.

statscraft help CD prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

FILE HANDLE

Give a file or a folder a short name to use in place of its path.

Syntax

FILE HANDLE handle /NAME='path' [/MODE=CHARACTER] [/ENCODING='name'] [/RECFORM=...]
            [/LRECL=n].
Every command that takes a file (GET, SAVE, DATA LIST, GET DATA, MATCH FILES, ADD FILES,
APPLY DICTIONARY, AGGREGATE OUTFILE, INSERT, INCLUDE, CD) takes the handle in place of the
path, quoted or not; 'handle/name.sav' starts from the path of a folder handle. A dataset
of the same name comes before a handle. A relative NAME starts from the folder of the last
CD. ENCODING is the encoding of a text file read through the handle, when the command gives
none. RECFORM and LRECL are ignored with a warning; MODE other than CHARACTER (binary and
EBCDIC files) is refused. Handles last for the session.

Example

FILE HANDLE wave2 /NAME='data/2026/wave2.sav'.
GET FILE=wave2.

statscraft help FILE HANDLE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

DATASET NAME

Give the active dataset a name, so that it stays open when another one becomes active.

Syntax

DATASET NAME name [WINDOW=ASIS | FRONT].
A dataset that had the name before is closed. WINDOW is accepted and has no effect.

Example

DATASET NAME survey.

statscraft help DATASET NAME prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

DATASET ACTIVATE

Make a named dataset the active one.

Syntax

DATASET ACTIVATE name [WINDOW=ASIS | FRONT].
The dataset that was active stays open when it has a name, else it is closed.

Example

DATASET ACTIVATE survey.

statscraft help DATASET ACTIVATE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

DATASET COPY

Copy the active dataset, as it is now, into a named dataset.

Syntax

DATASET COPY name [WINDOW=MINIMIZED | HIDDEN | FRONT].
A dataset that had the name is replaced, with a warning. When the active dataset has the
name, the copy takes it and the active dataset is left without a name.

Example

DATASET COPY men.

statscraft help DATASET COPY prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

DATASET DECLARE

Reserve a dataset name for a dataset that a later command creates.

Syntax

DATASET DECLARE name [WINDOW=MINIMIZED | HIDDEN | FRONT].

Example

DATASET DECLARE results.

statscraft help DATASET DECLARE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

DATASET CLOSE

Close a named dataset, or take the name off the active one.

Syntax

DATASET CLOSE name | * | ALL.
The active dataset stays open: closing it, or *, only takes its name off. ALL closes every
other dataset.

Example

DATASET CLOSE men.

statscraft help DATASET CLOSE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

DATASET DISPLAY

List the open datasets.

Syntax

DATASET DISPLAY.

Example

DATASET DISPLAY.

statscraft help DATASET DISPLAY prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

OUTPUT NEW

Start a new output document, which gets the tables from now on.

Syntax

OUTPUT NEW [NAME=name] [TYPE=VIEWER].
The tables of the commands that follow go to the new document until another one is
started or activated. Without NAME it is called Document1, Document2 and so on; a name
that another document had passes to the new one, and the other gets a new name. TYPE is
ignored. The window shows the tables of every document in its Output view; the documents
decide what OUTPUT EXPORT writes. The window session keeps its documents from run to run; a
command line run starts without one.

Example

OUTPUT NEW NAME=women.

statscraft help OUTPUT NEW prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

OUTPUT NAME

Name the output document that gets the tables.

Syntax

OUTPUT NAME [NAME=]name.
The designated document (the one that gets the tables) takes the name, and a document that
had it gets a new one. Without any document yet, an empty one is started.

Example

OUTPUT NAME men.

statscraft help OUTPUT NAME prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

OUTPUT ACTIVATE

Send the tables from now on to an open output document.

Syntax

OUTPUT ACTIVATE [NAME=]name.
A name that no open document has gives a warning, and the tables keep going where they went.

Example

OUTPUT ACTIVATE men.

statscraft help OUTPUT ACTIVATE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

OUTPUT CLOSE

Close an output document, or all of them.

Syntax

OUTPUT CLOSE [NAME=]name | * | ALL.
* closes the designated document. Nothing is saved; the next table starts a new document.
A name that no open document has is ignored with a warning.

Example

OUTPUT CLOSE *.

statscraft help OUTPUT CLOSE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

OUTPUT DISPLAY

List the open output documents.

Syntax

OUTPUT DISPLAY.
One row per document with its number of tables; the designated one is marked.

Example

OUTPUT DISPLAY.

statscraft help OUTPUT DISPLAY prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

OUTPUT EXPORT

Write the tables of an output document to an Excel workbook, web page, text or CSV file.

Syntax

OUTPUT EXPORT [NAME=* | name] [/CONTENTS [EXPORT=ALL | VISIBLE] [LAYERS=...] [MODELVIEWS=...]]
   [/XLSX DOCUMENTFILE='path' [OPERATION=CREATEFILE | CREATESHEET | MODIFYSHEET] [SHEET='name']
          [LOCATION=LASTCOLUMN | LASTROW | STARTCELL('B2')] [NOTESCAPTIONS=YES | NO]]
   [/HTML DOCUMENTFILE='path' [NOTESCAPTIONS=YES | NO] [STYLING=YES | NO] [IMAGEFORMAT=...]
          [INTERACTIVELAYERS=NO | YES]]
   [/TEXT DOCUMENTFILE='path' [ENCODING=LOCALE | UTF8 | UTF16] [NOTESCAPTIONS=YES | NO]
          [COLUMNWIDTH=AUTOFIT | n] [SEPARATOR=SPACE | TAB] [ROWBORDER='-'] [COLUMNBORDER='|']]
   [/CSV DOCUMENTFILE='path' [NOTESCAPTIONS=YES | NO]] [/BMP | /EMF | /EPS | /JPG | /PNG | /TIF ...].
Writes the tables that the designated document (NAME=*) or the named one holds so far, in
order; an existing file is replaced. Subcommands and keywords are spelled in full. Every
table is visible and has one layer, so CONTENTS changes nothing. NOTESCAPTIONS=NO leaves out
the notes under the tables. XLSX puts the tables one below the other on one sheet, named by
SHEET or Tables, laid out as the Excel export of the window. CREATESHEET and MODIFYSHEET add
to a workbook that OUTPUT EXPORT wrote earlier in the session and that has not changed since;
another workbook is refused, so its formulas and formatting cannot be lost. CREATESHEET
replaces or adds the sheet; MODIFYSHEET places the tables after the last column or row of
the sheet, one column or row apart, or from STARTCELL. HTML writes one web page; STYLING=NO
leaves out the style sheet. TEXT lines the columns up between the borders, or with
SEPARATOR=TAB separates the cells by tabs; COLUMNWIDTH=n wraps longer cells; LOCALE and UTF8
write UTF-8, UTF16 writes UTF-16 with a byte order mark. CSV, a Statscraft addition, writes
each table as comma-separated values after its title, with a blank line between tables.
Statscraft draws no charts, so the image subcommands change nothing. /DOC, /PDF, /PPT, /XLS
and /XLSM are refused.

Example

OUTPUT EXPORT /XLSX DOCUMENTFILE='results.xlsx' SHEET='Region 1'.

statscraft help OUTPUT EXPORT prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

USE

Use all cases, or a range of cases, in the commands that follow.

Syntax

USE ALL.
USE [first] [THRU [last]] [/PERMANENT].
USE ALL (or THRU alone) turns FILTER off. A range of case numbers is supported with
/PERMANENT, which deletes the cases outside it; dates are not supported yet.

Example

USE ALL.

statscraft help USE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

DISPLAY

Show dictionary information of the active dataset.

Syntax

DISPLAY [SORTED] [NAMES | INDEX | VARIABLES | LABELS | DICTIONARY | ATTRIBUTES | @ATTRIBUTES
         | SCRATCH | VECTOR | MACROS | DOCUMENTS | FILE LABEL] [/VARIABLES=varlist].
NAMES (the default): names. INDEX: names and positions. VARIABLES: also formats and missing
values. LABELS: positions and labels. DICTIONARY: everything, value labels included.
ATTRIBUTES: custom attributes except those starting with @ or $@; @ATTRIBUTES all of them.
MACROS: the names of the macros defined in this run and the runs of the session before,
sorted. SORTED sorts by name; /VARIABLES limits the list.

Example

DISPLAY SORTED DICTIONARY /VARIABLES=age TO q5.

statscraft help DISPLAY prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

LIST

List the values of cases.

Syntax

LIST [[VARIABLES=]varlist] [/CASES=[FROM n] [TO n] [BY n]] [/FORMAT=[NUMBERED | UNNUMBERED]
     [WRAP | SINGLE]].
Values show in their print format; system-missing is a period. NUMBERED adds the case
number. Follows FILTER and SPLIT FILE.

Example

LIST VARIABLES=id age /CASES=FROM 1 TO 10 /FORMAT=NUMBERED.

statscraft help LIST prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

ADD VALUE LABELS

Add or change value labels, keeping the other labels of the variables.

Syntax

ADD VALUE LABELS varlist value 'label' [value 'label' ...] [/ varlist ...].
Values are numbers or quoted strings; a label may be joined from pieces with +.

Example

ADD VALUE LABELS q1 TO q5 9 'No answer' / plan 'x' 'Unknown'.

statscraft help ADD VALUE LABELS prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

FILE LABEL

Set the label of the data file.

Syntax

FILE LABEL text.
The text needs no quotes; a label that starts with a quote is read as a quoted string.

Example

FILE LABEL Survey wave 2, cleaned.

statscraft help FILE LABEL prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

DOCUMENT

Add free text to the documents of the data file.

Syntax

DOCUMENT text.
The text may run over several lines and hold blank lines; a period at the end of a
line ends it. Every line becomes a line of the documents.

Example

DOCUMENT Weights were trimmed at 5.

statscraft help DOCUMENT prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

ADD DOCUMENT

Add quoted lines to the documents of the data file.

Syntax

ADD DOCUMENT 'line' ['line' ...].
Each string is one line; an empty string gives a blank line.

Example

ADD DOCUMENT 'Cleaned on 10 November.' 'Outliers removed.'

statscraft help ADD DOCUMENT prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

DROP DOCUMENTS

Remove the documents of the data file.

Syntax

DROP DOCUMENTS.

Example

DROP DOCUMENTS.

statscraft help DROP DOCUMENTS prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

VARIABLE ROLE

Set the role of variables for dialogs.

Syntax

VARIABLE ROLE /INPUT varlist /TARGET varlist /BOTH varlist /NONE varlist
              /PARTITION varlist /SPLIT varlist.
At least one subcommand; a variable named twice keeps its last role.

Example

VARIABLE ROLE /INPUT age income /TARGET satisfaction /NONE id.

statscraft help VARIABLE ROLE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

VARIABLE ALIGNMENT

Set the alignment of variables in the data grid.

Syntax

VARIABLE ALIGNMENT varlist (LEFT | RIGHT | CENTER) [[/] varlist (...) ...].

Example

VARIABLE ALIGNMENT id (LEFT) / q1 TO q5 (CENTER).

statscraft help VARIABLE ALIGNMENT prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

VARIABLE ATTRIBUTE

Set or delete custom attributes of variables.

Syntax

VARIABLE ATTRIBUTE VARIABLES=varlist ATTRIBUTE=name('value') [name[n]('value') ...]
                   [DELETE=name [name[n] ...]] [/VARIABLES=...].
name[n] is element n of an attribute array (from 1); DELETE=name[n] removes it and moves
the later elements up, DELETE=name removes the whole attribute. Values are always quoted.

Example

VARIABLE ATTRIBUTE VARIABLES=q1 q2 ATTRIBUTE=Source('wave 2') Note[2]('checked').

statscraft help VARIABLE ATTRIBUTE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

DATAFILE ATTRIBUTE

Set or delete custom attributes of the data file.

Syntax

DATAFILE ATTRIBUTE ATTRIBUTE=name('value') [name[n]('value') ...] [DELETE=name ...].
As VARIABLE ATTRIBUTE, for the file.

Example

DATAFILE ATTRIBUTE ATTRIBUTE=Version('2') Revised[1]('2026-11-10').

statscraft help DATAFILE ATTRIBUTE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

ALTER TYPE

Change the type, string width or format of variables.

Syntax

ALTER TYPE varlist ([input =] format | AMIN [+ n[%]]) [varlist (...) ...] [/PRINT ...].
A string variable may get another width (A20); values longer than it are cut. A numeric
variable may get another numeric format, or become a string holding its formatted
values; a string may become numeric with an F, COMMA or DOT format, a value that is no
number becoming system-missing. A type change drops value labels and missing values.
input = (A=, F=, A10=) limits the change to variables of that type and width.
AMIN gives a string variable the width of its longest value, plus n bytes or n percent of
that width (rounded).
/PRINT is accepted; no report is shown.

Example

ALTER TYPE comment (A500) code (A=AMIN).

statscraft help ALTER TYPE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

APPLY DICTIONARY

Copy dictionary information from a data file or dataset to the active dataset.

Syntax

APPLY DICTIONARY FROM 'file' | dataset | * [/SOURCE VARIABLES=varlist]
                 [/TARGET VARIABLES=varlist] [/NEWVARS]
                 [/FILEINFO [ATTRIBUTES[=REPLACE | MERGE]] [DOCUMENTS[=...]] [FILELABEL]
                            [MRSETS[=...]] [VARSETS[=...]] [WEIGHT] [ALL]]
                 [/VARINFO [ALIGNMENT] [ATTRIBUTES[=...]] [FORMATS] [LEVEL] [MISSING]
                           [ROLE] [VALLABELS[=REPLACE | MERGE]] [VARLABEL] [WIDTH] [ALL]].
Variables match by name and type; with a different type only the label is copied.
Without VARINFO everything but attributes is copied, value labels replacing; without
FILEINFO only the weight. SOURCE with one variable and TARGET copies that variable's
information to every target of the same type. Empty information in the source does
not overwrite the active dataset's. NEWVARS adds the source variables the active dataset
lacks, with their dictionary information and missing values; without an active dataset it
makes one with the source's variables and no cases.

Example

APPLY DICTIONARY FROM 'template.sav' /FILEINFO VARSETS=MERGE MRSETS.

statscraft help APPLY DICTIONARY prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

GET DATA

Read a text data file or a sheet of a workbook as the active dataset.

Syntax

GET DATA /TYPE=TXT /FILE='path' [/ENCODING='name'] [/ARRANGEMENT=DELIMITED | FIXED]
         [/FIRSTCASE=n] [/DELCASE=LINE | VARIABLES n] [/FIXCASE=n] [/DELIMITERS="chars"]
         [/QUALIFIER="c"] [/IMPORTCASE=ALL | FIRST n] [/MULTIPLESPACES IGNORE=NO | YES]
         [/LEADINGSPACES IGNORE=NO | YES]
         /VARIABLES=name format [name format ...].
GET DATA /TYPE=XLSX | XLSM | XLS /FILE='path' [/SHEET=INDEX n | NAME 'name']
         [/CELLRANGE=FULL | RANGE 'A1:K14'] [/READNAMES=ON | OFF] [/ASSUMEDSTRWIDTH=n]
         [/HIDDEN IGNORE=NO | YES] [/LEADINGSPACES IGNORE=NO | YES]
         [/TRAILINGSPACES IGNORE=NO | YES] [/DATATYPEMIN PERCENTAGE=n].
Text files. FIXED: /VARIABLES=[/record] name first-last format ..., columns counted from 0.
format: F, A, DATE, ADATE, SDATE, DATETIME, DOLLAR, COMMA and the other input formats, with
or without a width; AUTO reads a number when every value is one, else a string as wide as the
longest value; X skips the field. DELIMITERS: \t is a tab, \\ a backslash; two delimiters
in a row leave a value empty. Default delimiters: tab and comma. A value between
qualifiers may hold delimiters and line breaks; a doubled qualifier is one. SET DECIMAL=COMMA
reads a comma as the decimal mark. ENCODING as for INSERT; a byte order mark wins.
Workbooks (XLSX and XLSM from Excel 2007 on, XLS from Excel 95 to 2003). The first sheet by
default; FULL reads from the first to the last cell with a value. READNAMES=ON (default)
takes the first row as names, made valid: other characters become _, a name that does not
start with a letter gets a V in front, a repeated one _2; OFF and an empty heading give V1,
V2, ... by the column in the range. A column is numeric (F, 0 or 2 decimals) when all its
values are numbers (TRUE and FALSE are 1 and 0), a date when all are dates or times (DATE11,
TIME8 or DATETIME20), else a string as wide as its longest value. DATATYPEMIN PERCENTAGE=n
(over 50) lets the kind of n percent of the values decide; the others become system-missing.
Empty rows and empty columns without a name are left out; error cells are empty. HIDDEN
IGNORE=YES leaves out hidden rows and columns (XLSX only). ASSUMEDSTRWIDTH cuts longer
strings (XLS: 255 by default). LEADINGSPACES IGNORE=YES removes leading blanks of strings;
TRAILINGSPACES IGNORE=YES leaves trailing blanks out of the width.
ODBC and OLEDB are not supported yet.

Example

GET DATA /TYPE=TXT /FILE='wave2.csv' /DELIMITERS="," /QUALIFIER='"' /FIRSTCASE=2
/VARIABLES=id F5 name A20 born SDATE10.
GET DATA /TYPE=XLSX /FILE='wave3.xlsx' /SHEET=NAME 'Answers' /CELLRANGE=RANGE 'A1:F200'.

statscraft help GET DATA prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

SAVE TRANSLATE

Write the active dataset to a CSV or tab-delimited text file or an Excel workbook.

Syntax

SAVE TRANSLATE OUTFILE='path' | handle /TYPE=CSV | TAB | XLS /VERSION=12 [/REPLACE]
    [/FIELDNAMES [VALUE=NAMES | LABELS]] [/CELLS=VALUES | LABELS] [/MISSING=IGNORE | RECODE]
    [/TEXTOPTIONS [DELIMITER='c'] [QUALIFIER='c'] [DECIMAL=DOT | COMMA] [FORMAT=PLAIN | VARIABLE]]
    [/EXCELOPTIONS SHEET='name'] [/ENCODING='name' [BOM=YES | NO]] [/UNSELECTED=RETAIN | DELETE]
    [/KEEP=varlist] [/DROP=varlist] [/RENAME=(old = new) ...].
TYPE may be left out for a .csv or .xlsx file; TYPE=XLSX is short for XLS /VERSION=12. An
existing file is overwritten only with REPLACE. FIELDNAMES writes a first row of names
(VALUE=LABELS: the variable labels, else the names). CELLS=LABELS writes the value label where
a value has one. MISSING=RECODE writes user-missing values as empty. UNSELECTED=DELETE leaves
out the cases FILTER leaves out. KEEP, DROP and RENAME shape the file only, in the order
written; KEEP does not change the order of the variables.
Text: system-missing is empty. FORMAT=PLAIN (default) writes numbers with the decimals they
need, dates as mm/dd/yyyy and times as hh:mm:ss; VARIABLE writes the display formats. The
decimal mark is DECIMAL's, else SET DECIMAL's. CSV separates values with a comma, or with a
semicolon when the decimal mark is a comma, and puts the qualifier (default ") around a value
that holds the delimiter, the qualifier (doubled inside) or a line break. TAB never qualifies.
ENCODING as for INSERT; the default is UTF-8 with a byte order mark, which BOM=NO leaves out.
Workbook: numbers keep their display format and dates and times are Excel dates;
system-missing is #NULL!. EXCELOPTIONS names the sheet (default Sheet1); more cases than a
sheet holds continue on further sheets.
Other types (SAS, STATA, dBASE, ODBC, 1-2-3, SYLK) and APPEND are not supported yet.

Example

SAVE TRANSLATE OUTFILE='wave2.xlsx' /TYPE=XLS /VERSION=12 /FIELDNAMES /CELLS=LABELS /REPLACE.
SAVE TRANSLATE OUTFILE='wave2.csv' /TYPE=CSV /FIELDNAMES /TEXTOPTIONS DECIMAL=COMMA /REPLACE.

statscraft help SAVE TRANSLATE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

TITLE

Put a title in the output, above the output that follows.

Syntax

TITLE [']text['].
Quotes are optional; with them the text may hold the other kind of quote. The title
is cut to 60 bytes and shows as a heading where the command stands.

Example

TITLE 'Wave 2: cleaned data'.

statscraft help TITLE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

SUBTITLE

Put a subtitle in the output, above the output that follows.

Syntax

SUBTITLE [']text['].
As TITLE, for a second heading. A blank subtitle (' ') shows nothing.

Example

SUBTITLE "Children's shoes only".

statscraft help SUBTITLE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

ECHO

Show a text in the output.

Syntax

ECHO 'text'.
Pieces joined with + show as one line.

Example

ECHO 'Checks done'.

statscraft help ECHO prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

NEW FILE

Start a new, empty active dataset.

Syntax

NEW FILE.
A named active dataset stays open under its name; an unnamed one is gone.

Example

NEW FILE.

statscraft help NEW FILE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

CLEAR TRANSFORMATIONS

Undo the transformations and dictionary changes since the last data pass.

Syntax

CLEAR TRANSFORMATIONS.
The dataset goes back to how it was after the last command that read the data
(a procedure, EXECUTE, SAVE, GET and the like) or the start of the run. Pending
PRINT, WRITE and XSAVE never run. Settings, titles and files stay as they are.

Example

CLEAR TRANSFORMATIONS.

statscraft help CLEAR TRANSFORMATIONS prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

ERASE

Delete a file.

Syntax

ERASE FILE [=] 'path'.
One file, named in full; no wildcards. A missing file is an error.

Example

ERASE FILE='old_extract.txt'.

statscraft help ERASE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

SYSFILE INFO

Show the dictionary of a data file without opening it as the active dataset.

Syntax

SYSFILE INFO [FILE=] 'path'.
A table of the file (label, cases, variables, documents) and the tables of
DISPLAY DICTIONARY. PASSWORD (encrypted files) is not supported yet.

Example

SYSFILE INFO FILE='survey.sav'.

statscraft help SYSFILE INFO prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

PERMISSIONS

Make a file read-only, or writeable for its owner.

Syntax

PERMISSIONS FILE='path' /PERMISSIONS READONLY | WRITEABLE.
READONLY takes the write permission from everyone; WRITEABLE gives it to the owner.
On a file system without such permissions READONLY sets the read-only flag.

Example

PERMISSIONS FILE='final.sav' /PERMISSIONS READONLY.

statscraft help PERMISSIONS prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

HOST

Refused: Statscraft never runs operating system commands from syntax.

Syntax

HOST COMMAND=['command' ...] [TIMELIMIT=n].
Read and checked, then refused with an error: a command run from a syntax file
could do anything the user can, which makes shared syntax a security risk. Run the
commands outside Statscraft, before or after the syntax.

Example

HOST COMMAND=['dir'].

statscraft help HOST prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

FINISH

End the job: the commands after it are not read.

Syntax

FINISH.
The run ends here, as at the end of the syntax. Nothing after FINISH is read, so it causes
no error. FINISH in an inserted file ends the whole run; when a range of lines runs, only a
FINISH inside it counts. The window and its session stay open.

Example

FREQUENCIES VARIABLES=region.
FINISH.

statscraft help FINISH prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

DATE

Add date variables that count the cases of a time series.

Syntax

DATE keyword [start [period]] [keyword ...] [BY n].
keyword: YEAR QUARTER MONTH (long periods), WEEK DAY HOUR MINUTE SECOND (short periods),
CYCLE, OBS; any start of the word, MINUTE from MI. Long and short do not mix.
Each keyword makes a numeric variable named keyword_; DATE_ (a string) shows them all,
and CYCLE_ is added when the highest keyword has a period. Defaults: start 1 (HOUR,
MINUTE, SECOND 0), period QUARTER 4, MONTH 12, DAY 7, HOUR 24, MINUTE and SECOND 60,
none for the highest keyword except QUARTER. OBS needs a start and a period; CYCLE takes
no period. QUARTER and MONTH give each other their start; with MONTH the quarter
follows the month. BY n steps the lowest keyword and must divide its period. Earlier
DATE variables are replaced. A table lists the new variables and their labels.

Example

DATE Y 1990 M 7.

statscraft help DATE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

PRINT

Show the values of variables for every case, as lines of text.

Syntax

PRINT [OUTFILE='path'] [ENCODING='name'] [RECORDS=n] [TABLE | NOTABLE]
      /[line] item [item ...] [/[line] ...].
item: varlist, varlist first-last [(type[,decimals])], varlist (format list), 'text'
[column], or * to end the variables a format applies to. Format list: formats such as
F8.2, n(...) repeats, Tn goes to column n, nX skips n columns.
A transformation: the lines appear when the data are next read, case by case, one line
per slash. A variable in its own print format is followed by a blank; one with a given
format or columns is not. System-missing shows as a period. OUTFILE writes the lines to a
file, each starting with a blank (the carriage control), replaced on each data pass.
TABLE shows where each variable goes. Formats P, PK, IB, PIB, PIBHEX, RB, RBHEX and Z are
not supported yet.

Example

PRINT /id name (A10) score (F6.2).

statscraft help PRINT prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

PRINT EJECT

Like PRINT, starting a new page each time it runs.

Syntax

PRINT EJECT [OUTFILE='path'] [ENCODING='name'] [RECORDS=n] [TABLE | NOTABLE] /item ....
As PRINT. In the output each new page is a new table; in a file its first line starts
with 1 in place of the blank. Usually inside DO IF, for headings.

Example

DO IF $CASENUM = 1.
PRINT EJECT /'Name' 1 'Score' 12.
END IF.

statscraft help PRINT EJECT prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

PRINT SPACE

Add blank lines to the PRINT output, for every case it runs on.

Syntax

PRINT SPACE [OUTFILE='path'] [ENCODING='name'] [expression].
The expression gives the number of lines (default 1); a fraction is cut off; a missing
or negative number gives one line and a warning. Usually inside DO IF.

Example

PRINT SPACE.

statscraft help PRINT SPACE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

WRITE

Write the values of variables for every case to a text file.

Syntax

WRITE [OUTFILE='path'] [ENCODING='name'] [BOM=YES | NO] [RECORDS=n] [TABLE | NOTABLE]
      /[line] item [item ...] [/[line] ...].
Items as on PRINT, in the write formats, with no blank between values and no carriage
control. System-missing is written as blanks. Without OUTFILE the lines go to the output.
The file is replaced on each data pass; commands that name the same file in one pass
write to it in case order. ENCODING: UTF-8 (default, no byte order mark), UTF-16,
UTF-16LE, UTF-16BE or a code page such as windows-1252; a UTF encoding given by name
gets a byte order mark unless BOM=NO.

Example

WRITE OUTFILE='scores.txt' /id (F4) score (F6.2).

statscraft help WRITE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

PRINT FORMATS

Set the print format of variables: how procedures and PRINT show them.

Syntax

PRINT FORMATS varlist (format) [[/] varlist (format) ...].
As FORMATS, but the write format stays as it is. A string variable keeps its width.

Example

PRINT FORMATS salary (DOLLAR8) / rate (PCT5.1).

statscraft help PRINT FORMATS prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

WRITE FORMATS

Set the write format of variables: how WRITE writes them.

Syntax

WRITE FORMATS varlist (format) [[/] varlist (format) ...].
As FORMATS, but the print format stays as it is. Saved with the data file.

Example

WRITE FORMATS salary (F10.2).

statscraft help WRITE FORMATS prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

XSAVE

Write the cases to a data file as the next data pass reads them.

Syntax

XSAVE OUTFILE='path' | handle [/KEEP=varlist] [/DROP=varlist] [/RENAME=(old = new) ...]
      [/MAP] [/COMPRESSED | /ZCOMPRESSED] [/PERMISSIONS=READONLY | WRITEABLE].
A transformation: the file holds the cases as they reach XSAVE in the next procedure or
EXECUTE (or the end of the run), with the variables of that moment, scratch variables
left out. KEEP, DROP and RENAME as on SAVE. MAP lists the saved variables. Two XSAVE
commands cannot write the same file in one pass. /UNCOMPRESSED is not supported yet.

Example

XSAVE OUTFILE='wave2.sav' /DROP=tmp1 TO tmp5.

statscraft help XSAVE prints the same text in the terminal. All commands

Statscraft 0.7.0, release v0.7.0

Command line help

The output of statscraft --help and of --help on every subcommand. The command line explains them with examples.

Statistics workbench

Usage: statscraft <COMMAND>

Commands:
  describe  Show the dictionary and basic counts of a data file or of a session
  run       Run syntax. With --session the dataset, settings and macros are kept between runs
  check     Validate syntax against the session's dataset without saving or writing anything
  help      Show the syntax of a command, or list all commands
  plan      Lower bounded syntax to an OpenStatSpec transformation plan (JSON)
  db        Store datasets in an OpenStatSpec SQLite database and read them back
  update    Update this installation to the latest published release

Options:
  -h, --help     Print help
  -V, --version  Print version

statscraft describe

Show the dictionary and basic counts of a data file or of a session

Usage: statscraft describe [OPTIONS] [FILE]

Arguments:
  [FILE]  A .sav or .zsav file

Options:
  -s, --session <SESSION>  Describe this session (dataset, settings, macros) instead of a file; gui is the window
      --json               Print the result as JSON
  -h, --help               Print help

statscraft run

Run syntax. With --session the dataset, settings and macros are kept between runs

Usage: statscraft run [OPTIONS] [FILE]

Arguments:
  [FILE]  Syntax file, or - for standard input

Options:
  -e, --execute <TEXT>      Syntax text given directly
  -s, --session <SESSION>   Session name: the dataset, settings and macros are loaded from and saved to .statscraft/sessions/<name>. The name gui sends the syntax to the running statscraft-gui window instead
      --lines <FIRST-LAST>  Run only the commands inside this inclusive line range, for example 40-55
      --json                Print tables, changes, warnings and errors as JSON
      --encoding <NAME>     Encoding of the syntax file, such as windows-1257 or 1252. Default: UTF-8 when the file is valid UTF-8 (with or without a byte order mark), else the system's legacy code page
      --xlsx <FILE>         Also write every table of the run to this Excel workbook, one sheet per table
      --xlsx-one-sheet      With --xlsx, put all tables on one sheet, one below the other
  -h, --help                Print help

statscraft check

Validate syntax against the session's dataset without saving or writing anything

Usage: statscraft check [OPTIONS] [FILE]

Arguments:
  [FILE]  Syntax file, or - for standard input

Options:
  -e, --execute <TEXT>      Syntax text given directly
  -s, --session <SESSION>   Session name: the dataset, settings and macros are loaded from and saved to .statscraft/sessions/<name>. The name gui sends the syntax to the running statscraft-gui window instead
      --lines <FIRST-LAST>  Run only the commands inside this inclusive line range, for example 40-55
      --json                Print tables, changes, warnings and errors as JSON
      --encoding <NAME>     Encoding of the syntax file, such as windows-1257 or 1252. Default: UTF-8 when the file is valid UTF-8 (with or without a byte order mark), else the system's legacy code page
  -h, --help                Print help

statscraft plan

Lower bounded syntax to an OpenStatSpec transformation plan (JSON)

Usage: statscraft plan [OPTIONS] [FILE]

Arguments:
  [FILE]  Syntax file, or - for standard input

Options:
  -e, --execute <TEXT>            Syntax text given directly
      --input-schema <FILE>       Input schema: a JSON file with {"variables": [{"name", "storage_kind", ...}]}
  -s, --session <SESSION>         Take the input schema from the dataset of this session
      --sqlite <DB>               OpenStatSpec SQLite database file
      --postgres <URL>            PostgreSQL: postgres://user@host:port/database[?schema=NAME], schema default openstatspec; TLS with &sslmode=verify-full|verify-ca|require and &sslrootcert=CA.pem
      --mysql <URL>               MySQL or MariaDB: mysql://user@host:port/database, a database dedicated to the catalog; TLS with ?ssl-mode=VERIFY_IDENTITY|VERIFY_CA|REQUIRED and &ssl-ca=CA.pem
      --dolt <URL>                Dolt sql-server: mysql://user@host:port/database, a database dedicated to the catalog; TLS as for --mysql
      --name <DATASET>            Dataset name in the database
      --apply                     Apply the plan to the dataset in place
      --expected-branch <BRANCH>  Dolt: the branch the apply must run on
      --expected-head <COMMIT>    Dolt: the commit HEAD must be at
      --actor <ACTOR>             Who applies the plan, for the audit row; defaults to $USER
      --profile <PROFILE>         Frontend profile version [default: 0.3] [possible values: 0.1, 0.2, 0.3]
      --alias <ALIAS>             Symbolic name of the input dataset in the plan [default: input]
  -h, --help                      Print help

Prints one line of canonical JSON: {"ok":true,"plan":...,"plan_hash":...,"source_hash":...}, or {"ok":false,"error":{"code":...,"message":...,"line":...,"column":...},...}. The plan hash is SHA-256 of the canonical plan; the source hash is SHA-256 of the source with line ends converted to LF.

Profile 0.1: RECODE, VARIABLE LABELS, VALUE LABELS.
Profile 0.2 adds COMPUTE target = operand, IF (predicate) target = operand, FORMATS (F only), VARIABLE LEVEL and EXECUTE.
Profile 0.3 adds comments, TO lists, NE <> ~= and NOT, LOWEST/HIGHEST ranges and ADD VALUE LABELS.
Anything else is rejected: this is OpenStatSpec's bounded frontend, not the full language of `statscraft run`.

With --sqlite DB, --postgres URL, --mysql URL or --dolt URL and --name DATASET the input schema comes from that OpenStatSpec dataset, and --apply applies the plan to it in place, in one transaction with one audit row; the output then has "applied":{"apply_id":...,"dataset_id":...,"operation_count":...}. On Dolt, --apply needs --expected-branch and --expected-head: the session must be on that branch at that commit with a clean working set, and the changes stay uncommitted.

statscraft db

Store datasets in an OpenStatSpec SQLite database and read them back

Usage: statscraft db <COMMAND>

Commands:
  export        Store a .sav/.zsav file, or the dataset of a session, as a dataset in the database
  import        Read a dataset from the database into a .sav/.zsav file or a session
  capabilities  Print the adapter's capability declaration: versions, limits and atomicity per profile

Options:
  -h, --help  Print help

Prints one line of canonical JSON: {"ok":true,...} or {"ok":false,"error":{"code":...,"message":...}}.

The database is dedicated to OpenStatSpec: a SQLite file, a PostgreSQL schema, or a MySQL, MariaDB or Dolt database. On Dolt, `db export` leaves its changes in the working set and never commits, and `db import` writes nothing at all. Export creates the catalog in a new or empty one and refuses one holding anything else. Each dataset is one table data_<name> with __case_ordinal and one column per variable; the dictionary lives in the catalog tables. A URL without a password takes it from the STATSCRAFT_DB_PASSWORD environment variable; passwords are never printed. Connections are plain TCP unless the URL asks for TLS; TLS always verifies the server certificate against the CA file or the bundled Mozilla roots, and the host name unless the mode is verify-ca.

statscraft db export

Store a .sav/.zsav file, or the dataset of a session, as a dataset in the database

Usage: statscraft db export [OPTIONS] [FILE]

Arguments:
  [FILE]  A .sav or .zsav file

Options:
  -s, --session <SESSION>  Export the dataset of this session instead of a file
      --sqlite <DB>        OpenStatSpec SQLite database file
      --postgres <URL>     PostgreSQL: postgres://user@host:port/database[?schema=NAME], schema default openstatspec; TLS with &sslmode=verify-full|verify-ca|require and &sslrootcert=CA.pem
      --mysql <URL>        MySQL or MariaDB: mysql://user@host:port/database, a database dedicated to the catalog; TLS with ?ssl-mode=VERIFY_IDENTITY|VERIFY_CA|REQUIRED and &ssl-ca=CA.pem
      --dolt <URL>         Dolt sql-server: mysql://user@host:port/database, a database dedicated to the catalog; TLS as for --mysql
      --name <NAME>        Dataset name: ASCII letters, digits and _; defaults to the file or session name
  -h, --help               Print help

statscraft db import

Read a dataset from the database into a .sav/.zsav file or a session

Usage: statscraft db import [OPTIONS] --name <NAME>

Options:
      --sqlite <DB>        OpenStatSpec SQLite database file
      --postgres <URL>     PostgreSQL: postgres://user@host:port/database[?schema=NAME], schema default openstatspec; TLS with &sslmode=verify-full|verify-ca|require and &sslrootcert=CA.pem
      --mysql <URL>        MySQL or MariaDB: mysql://user@host:port/database, a database dedicated to the catalog; TLS with ?ssl-mode=VERIFY_IDENTITY|VERIFY_CA|REQUIRED and &ssl-ca=CA.pem
      --dolt <URL>         Dolt sql-server: mysql://user@host:port/database, a database dedicated to the catalog; TLS as for --mysql
      --name <NAME>        Dataset name
      --out <FILE>         Write this .sav or .zsav file
  -s, --session <SESSION>  Make the dataset the one of this session instead
      --allow-loss         Go on when the catalog holds items the dataset cannot keep, and record each loss
  -h, --help               Print help

statscraft db capabilities

Print the adapter's capability declaration: versions, limits and atomicity per profile

Usage: statscraft db capabilities

Options:
  -h, --help  Print help

statscraft update

Update this installation to the latest published release

Usage: statscraft update [OPTIONS]

Options:
      --check  Only check: exit code 0 when up to date, 10 when a newer release exists
      --json   With --check, print the result as JSON
  -h, --help   Print help

Statscraft 0.7.0, release v0.7.0

Changelog

0.7.0 (2026-11-12)

  • Tables show variable and value labels, names or both, following SET TVARS, TNUMBERS, OVARS and ONUMBERS (labels by default, as the manual says). Edit > Settings has the two choices and keeps them.
  • Every dialog that writes syntax ends the same way: the syntax, OK, Paste and Cancel; Escape closes it. Hint lines and instruction tooltips are gone, and so is the View menu (the Data View has its own value labels switch).

0.6.0 (2026-11-12)

  • The MATRIX … END MATRIX language: COMPUTE, PRINT, DO IF, LOOP, READ, WRITE, GET, SAVE, MGET, MSAVE, CALL EIGEN, SVD and SETDIAG, and the whole function library.
  • Transformations know 185 of the manual’s functions: the distribution families (CDF, IDF, PDF, NCDF, SIG), every date and time function (DATEDIFF, DATESUM, XDATE, CTIME and the rest), the CHAR string functions, REPLACE, NORMALIZE, MEDIAN, VALUELABEL and more. The editor completes them.
  • SET BLANKS, EPOCH, FUZZBITS and SCALEMIN now take effect, and sessions keep them.

0.5.0 (2026-11-12)

  • New procedures: FACTOR (every extraction and rotation, KMO and Bartlett, saved scores), QUICK CLUSTER, CLUSTER (hierarchical, all measures and methods), DISCRIMINANT (direct and stepwise, classification, cross-validation), LOGISTIC REGRESSION (binary, contrasts, stepwise, Hosmer-Lemeshow), UNIANOVA and GLM (sums of squares types 1 to 4, EM means, post hoc, repeated measures) and ANOVA.
  • Input programs: INPUT PROGRAM, END CASE, END FILE, REPEATING DATA, FILE TYPE and RECORD TYPE, REREAD and LEAVE.
  • MATRIX DATA, REPORT, FINISH, and OUTPUT NEW, NAME, ACTIVATE, CLOSE, DISPLAY and EXPORT (Excel, HTML, text and CSV).
  • SHOW knows every keyword; SET LOCALE sets the decimal mark; PRESERVE and RESTORE with a setting name run without a warning.
  • Window: dialogs for Factor, K-Means Cluster, Hierarchical Cluster, Discriminant, Binary Logistic, General Linear Model Univariate and Repeated Measures.
  • New packages: a portable Windows ZIP without installer, and an app for macOS (Apple silicon and Intel, not signed yet: allow it once in System Settings, Privacy and Security). Both update from the window.

0.4.0 (2026-11-11)

  • Closing the window asks about unsaved data and syntax (Save, Don’t save, Cancel); so do New syntax, Open syntax and Restart now. Nothing unsaved closes without asking.
  • One Settings dialog (Edit > Settings) for the editor, grids and output, and updates; the quick menus no longer hold settings.
  • Grids: select with the mouse by clicking or dragging over cells, headers and row numbers; Delete clears the selected cells; system-missing shows as a grey dot; numbers stay right-aligned when their labels are too long for the cell; no shadows anywhere.
  • A shorter right-click menu on columns and Variable View rows: sort, Frequencies, Descriptives, rename, insert, copy, delete.
  • Analyze dialogs for Linear Regression, Reliability Analysis, the Nonparametric Tests and Partial Correlations.
  • New commands: TITLE, SUBTITLE, ECHO, NEW FILE, CLEAR TRANSFORMATIONS, ERASE, SYSFILE INFO, PERMISSIONS, DATE, PRINT, PRINT EJECT, PRINT SPACE, WRITE, PRINT FORMATS, WRITE FORMATS and XSAVE. HOST is refused for safety.

0.3.0 (2026-11-11)

  • New procedures: REGRESSION (linear, with stepwise methods, statistics and saved variables), RELIABILITY (alpha, split-half, Guttman, parallel models, intraclass correlations), NPAR TESTS (every one-sample, independent and related samples test, exact where the manual says), PARTIAL CORR, MULT RESPONSE and TREE (CHAID and exhaustive CHAID).
  • Restructuring and merging: VARSTOCASES, CASESTOVARS, FLIP, UPDATE, SORT VARIABLES, STAR JOIN; ADD FILES and MATCH FILES with IN, FIRST, LAST and MAP.
  • Spreadsheets and text: GET DATA reads Excel workbooks; SAVE TRANSLATE writes CSV, tab-delimited text and XLSX. In the window, File > Open data and File > Export data, and dropped workbooks and text files open.
  • Dates, times and custom currencies show in their formats in every table, the Data View and Excel export (as real Excel dates and numbers).
  • FILE HANDLE; SET SEED, RNG and MTINDEX with the random number functions; PRESERVE and RESTORE for every setting.
  • Command-line sessions keep settings, PRESERVE levels, the CD folder, file handles and the random numbers between runs; describe shows them.
  • Faster CTABLES on large stacked tables; shortened function names such as SYS; CROSSTABS /COUNT and /FORMAT.
  • Window: dialogs for Multiple Response, Tree, Restructure and Sort Variables.

0.2.0 (2026-11-11)

  • New app icon and the Statscraft name everywhere: window, installers, file types, documentation and the product string of written .sav files. Installing 0.2.0 over 0.1.x keeps the same install and file associations.
  • Window: right-click menus in the Data View (column headers, cells, row numbers) and the Variable View: sort, quick Frequencies and Descriptives, prefilled dialogs, measure, rename, insert, delete, filter to a value, keep only those cases, copy.
  • Window: the log shows only under Syntax and Output, so the grids use the whole height; cells follow each variable’s alignment; cases left out by FILTER have their row number struck through.
  • INCLUDE and INSERT without FILE= read the file before the next lines, so the macros of a macro library can be called right after it.
  • CTABLES: the NEGPAREN, NEQUAL, PAREN, PCTPAREN, DOT, N and E summary formats; )DATE, )TIME and )TABLE in titles; a function repeated in one summary list gives two columns.
  • Window: the Statscraft colours (petrol) for selection, focus, links and OK buttons; Schibsted Grotesk and JetBrains Mono bundled, with digits of equal width so numbers line up; Statscraft Light and Dark syntax colours, Light the default.

0.1.1 (2026-11-10)

  • FREQUENCIES supports every subcommand (statistics with standard errors, formats, percentiles, ntiles, grouped data, order); chart requests give a warning instead of an error.
  • RANK with every function, tie rule and fraction method.
  • Encrypted database connections (TLS with certificate checks) and much faster storing and reading of large datasets in PostgreSQL, MySQL, MariaDB, Dolt and SQLite.
  • Update checks run quietly in the background; the window no longer shows a notice about them on the first start.
  • Window: Variable View with dialogs for type and format, value labels and missing values editors (with pasting many codes at once), row selection with Delete, spreadsheet keys, Ctrl+F to find a variable, Ctrl+C as tab-separated text; Rank, Automatic Recode and Split File dialogs; Select Cases filters by default; split, filter and weight shown in the status bar.
  • Syntax editor: themes (Catppuccin, One Dark, Solarized, GitHub), macros in completion, fills its tab. Output: no automatic selection, a margin around tables. Square corners throughout; Help links open in the browser.
  • Macros defined in a session last across its runs; macro arguments expand at the call as the manual says; dataset names in MATCH FILES, ADD FILES and AGGREGATE.

0.1.0 (2026-11-10, early release)

The first version for people who want to try StatsCraft and tell us what breaks. Expect rough edges; please report them (Issues, Bug report).

What it does

  • Reads and writes .sav and .zsav files, including labels, missing values, multiple response sets, dates and old encodings.
  • Macros (DEFINE with every argument kind, !LET, !IF, !DO and the string functions), INCLUDE and INSERT, syntax files in old encodings, SET, DATASET and the dictionary commands, GET DATA for text files.
  • Runs the established statistics command syntax: transformations (COMPUTE, IF, RECODE, COUNT, DO IF, SELECT IF, DO REPEAT, LOOP, VECTOR, AGGREGATE, AUTORECODE, file merging, SPLIT FILE, FILTER, TEMPORARY and more) and procedures (FREQUENCIES, DESCRIPTIVES, CROSSTABS, CTABLES, MEANS, T-TEST, ONEWAY, CORRELATIONS, NONPAR CORR, EXAMINE).
  • Custom tables: stacking, nesting, layers, totals and subtotals, percentages, multiple response sets, significance tests with column letters, effective base.
  • Desktop window: data and variable views, syntax editor, output view, dialogs that write syntax, Excel and HTML export.
  • Command line built for scripts and AI agents: sessions, running parts of a file by line range, JSON output with precise error positions, and a live link to the open window.
  • OpenStatSpec: store datasets in SQLite, PostgreSQL, MySQL, MariaDB or Dolt and apply transformation plans in place.

Known limits

  • The Windows installer is not signed yet, so Windows shows an “unknown publisher” warning; see Getting started.
  • No charts yet. Some commands and subcommands are not supported; see Differences and statscraft help.