Skip to content

BEGIN PROGRAM

Runs an embedded Python program with the orcstat API: read and write the data, run syntax, add tables and charts to the output, and define new procedures.

BEGIN PROGRAM [PYTHON3].
<Python code>
END PROGRAM.
Kind Session
Body free-form body
Changes data no
BEGIN PROGRAM PYTHON3.
import orcstat
ds = orcstat.active()
ds.set_values('bmi', ds.column('weight') / (ds.column('height') / 100) ** 2, label='BMI')
orcstat.submit('DESCRIPTIVES bmi.')
END PROGRAM.
BEGIN PROGRAM.
import orcstat
def run(proc):
v = proc.variables()[0]
x = proc.dataset.column(v)
proc.table('Range', ['Range'], [v], [[x.max() - x.min()]])
orcstat.register_procedure('RANGE STATS', run)
END PROGRAM.
RANGE STATS income.
  • BEGIN PROGRAM, the code and END PROGRAM. each start on their own line; the code is Python, not syntax, and keeps its indentation.
  • Programs run with your own rights, like any script. Programs proposed by the AI assistant never run, and programs in a project you open are blocked until you trust that project.
  • Variables, imports and functions persist between blocks in a session. print() output goes to the output as a log.
  • Commands after a block run once the program has finished, so they can use procedures the program registered.
  • A partial spss module (Submit, dictionary getters, read cursors) helps converted SPSS programs run; R programs are not available yet.
  • The journal records the whole block; syntax the program submits is not journalled separately.

OMS, INSERT


Generated from OrcStat’s command registry and reference. To suggest a change, open an issue.