help for qrisk2cmd, qrisk2import and qrisk2export(Roger Newson)

Running the QRISK2 command from within Stata

Run QRISK2 from within Stata

qrisk2cmd infilename outfilename

Import a QRISK2 input or output dataset

qrisk2import using filename [ , clear nokey ]

Export a QRISK2 inpt dataset

qrisk2export using filename [if] [in] [ , replace ]

Description

qrisk2cmd calls the QRISK2 command to convert from a QRISK2 input data file to a QRISK2 output data file.
qrisk2import inputs a QRISK2 input or output data file into a Stata dataset in memory.
qrisk2export exports a QRISK2 input data file,
using variables with standard QRISK2 names from the dataset in memory.
This package requires the QRISK2 program to be installed,
and also requires the SSC package keyby.

Options for qrisk2import

clear specifies that any existing dataset in memory will be replaced.

nokey specifies that the dataset produced will not be sorted by the patient ID variable row_id.
If nokey is not specified,
then qrisk2import uses the SSC package keyby to sort the dataset by row_id,
and issues an error message
if row_id either does not identify the observations uniquely
or is missing in some observations.
This is done because the datasets input and output by QRISK2 are assumed to have one row per patient,
identified by the variable row_id.

Options for qrisk2export

replace specifies that any existing file with the same name as the using file will be replaced. will be replaced.

Remarks

The QRISK2 command is a Java application sold by ClinRisk.
It inputs a comma-separated input file and outputs a comma-separated output file,
with the same variables as the input file,
plus some extra variables derived by QRISK2 from the input variables.
These extra variables include a variable patientscore,
containing a patient risk score for cardiovascular disease;

The comma-separated input and output files have a format that extends the generic .csv format,
but allows blank lines,
and also comment lines (beginning with #).
Both of these line types are ignored by QRISK2,
and also by qrisk2import.

Technical notes

qrisk2cmd calls the command-line version of the QRISK2 batch processor command.
This command-line version is an alternative to the menu-driven Windows version of the QRISK2 batch processor.
When ordering the QRISK2 batch processor from ClinRisk,
it is important for the user to specify either the command-line version
or the menu-driven Windows version.

The path for the QRISK2 command varies from system to system.
In general, it is composed of two components.
These are a library directory in which the QRISK2 command is located
and a filename, ending in the extension jar,
identifying the Java archive containing the QRISK2 program.
qrisk2cmd attempts to find these in two global macros,
whose names are qrisk2_lib for the library and qrisk2_jar for the .jar filename.
The best way of setting values for these is probably to include two global commands
in the user's profile do-file.
These commands might read

. global qrisk2_lib "S:\PITA\QRISK2\dist\lib\"

. global qrisk2_jar "QRISK2-2016-batchProcessor.jar"

If these global macros are both set, then the Java command passed by qrisk2cmd to the operating environment to execute QRISK2
has the form

java -Dderby.system.home=$qrisk2_lib -jar "$qrisk2_lib$qrisk2_jar" infilename outfilename

If the global macro qrisk2_lib is unset, then qrisk2cmd uses the current directory,
denoted .\ under Windows or ./ under Unix, Linux or MacOSX.
If the global macro qrisk2_jar is unset, then qrisk2cmd uses the value QRISK2-2016-batchProcessor.jar.
Note that the value of the global macro qrisk2_lib must contain the terminating directory separator,
which is \ under Windows and / under Unix, Linux or MacOSX.
Note, also, that, when the user upgrades to a new version of QRISK2,
the user may also have to change the name of the Java archive in the global macro qrisk2_jar,
and/or the library location in the global macro qrisk2_lib
may also need to be changed.

Examples

The following examples use the test datasets distributed with QRISK2.

. qrisk2cmd qrisk2Input.csv qrisk2Output.csv

. qrisk2import using qrisk2Output.csv, clear

. describe, full

. qrisk2import using qrisk2TestDataWithNoPostcodesAndZeroTownsend.csv, clear

. describe, full

. qrisk2export using mysubsetinput.csv in 1/20, replace

. qrisk2cmd mysubsetinput.csv mysubsetoutput.csv

. qrisk2import using mysubsetoutput.csv, clear

. describe, full

Author

Roger Newson, Imperial College London, UK.

Email: r.newson@imperial.ac.uk

Also see

Manual: [D] Import delimited

On-line: help for import delimited

keyby if installed.

Other: ClinRisk