help for cprdhesutil(Roger Newson)

Inputting Clinical Practice Research Datalink (CPRD) HES-linkage datasets into Stata

cprdhes_patient using filename [ , clear nokey delimiters("chars"[, collapse|asstring]) encoding(string) ]

cprdhes_hospital using filename [ , clear nokey delimiters("chars"[, collapse|asstring]) encoding(string) ]

cprdhes_episodes using filename [ , clear nokey delimiters("chars"[, collapse|asstring]) encoding(string) ]

cprdhes_diagnosis_epi using filename [ , clear nokey delimiters("chars"[, collapse|asstring]) encoding(string) ]

cprdhes_diagnosis_hosp using filename [ , clear delimiters("chars"[, collapse|asstring]) encoding(string) ]

cprdhes_primary_diag_hosp using filename [ , clear delimiters("chars"[, collapse|asstring]) encoding(string) ]

cprdhes_procedures_epi using filename [ , clear nokey delimiters("chars"[, collapse|asstring]) encoding(string) ]

cprdhes_acp using filename [ , clear nokey delimiters("chars"[, collapse|asstring]) encoding(string) ]

cprdhes_ccare using filename [ , clear delimiters("chars"[, collapse|asstring]) encoding(string) ]

cprdhes_maternity using filename [ , clear nokey delimiters("chars"[, collapse|asstring]) encoding(string) ]

cprdhes_hrg using filename [ , clear nokey delimiters("chars"[, collapse|asstring]) encoding(string) ]

Description

The cprdhesutil package is designed for use with the cprdutil package,
which creates Stata datasets from text data files
produced by the Clinical Practice Research Datalink (CPRD).
cprdhesutil is a suite of utility programs for inputting linkage text data files produced by CPRD
to contain data on the same patients from the Hospital Episodes System (HES),
and creating equivalent Stata datasets in the memory.
Each program in the suite imports into Stata a dataset type produced by a CPRD HES linkage retrieval,
with 1 observation for each of a set of things of a kind on which HES collects data,
such as patients, hospitalisation events, or episodes within hospitalisations.
cprdhesutil uses the SSC packages keyby, chardef, and lablist,
which need to be installed for cprdhesutil to work.

Options

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

nokey specifies that the dataset produced will not be sorted by a primary key of variables.
If nokey is not specified for a command that has a nokey option,
then the dataset will be sorted by a primary key of variables,
whose values will normally identify the observations uniquely,
with each value combination present in only one observation.

delimiters("chars"[, collapse|asstring])
specifies the delimiters used in the input text file.
This option functions as the option of the same name for import delimited.

encoding(string) specifies the encoding of the text file being imported.
This option functions as the option of the same name for import delimited in Stata Versions 14 or above,
or as the charset() option for import delimited in Stata Version 13.

Remarks

The Clinical Practice Research Datalink (CPRD) is a database of information
from primary-care practices in the British Health Service.
Tab-delimited text data files of various types can be produed by CPRD,
containing data on things known to these practices,
such as practices, patients, staff members, clinical events, additional details on clinical events,
consultations, immunisations, referrals, tests, and prescribed therapies.
These text datafiles can then be converted to Stata datasets using the SSC package cprdutil.

Researchers sometimes aim to answer questions about the incidence of events experienced by CPRD patients,
but recorded by data sources other than CPRD, such as the Hospital Episodes System (HES).
The cprdhesutil package allows users to do this.
It should be used in combination with the cprdlinkutil package,
also downloadable from SSC.

Datasets created by cprdhesutil modules

Each module of the cprdhesutil package inputs a text file on disk and creates a Stata dataset in memory,
with 1 observation per row of the input text file.
If the nokey option is not specified,
then the observations in the dataset will be keyed
(sorted and uniquely identified)
by the values of a list of variables, known as a primary key.
These variables, in each observation, identify a thing,
belonging to a class of things such as patients, hospital spells,
or hospital episodes under the care of a particular team.

The modules of cprdhesutil create datasets in memory,
whose primary keys are as follows:

Module Primary key

cprdhes_patient patid

cprdhes_hospital patid spno

cprdhes_episodes patid spno epikey

cprdhes_diagnosis_epi patid spno epikey d_order

cprdhes_diagnosis_hosp (No primary key)

cprdhes_primary_diag_hosp (No primary key)

cprdhes_procedures_epi patid spno epikey p_order

cprdhes_acp patid spno epikey acpn

cprdhes_ccare (No primary key)

cprdhes_maternity patid spno epikey matordr

cprdhes_hrg patid spno epikey

The key variable patid is an anonymised CPRD patient ID variable,
the key variable spno is a hospital spell ID variable,
the key variable epikey is a hospital episode ID variable,
and the key variables d_order, p_order, acpn and matordr
are within-episode identifiers for diagnoses, procedures, augmented care periods and maternity events,
respectively.
CPRD-linked HES data are provided mostly as records identified by patient,
hospitalisation spell,
and episode within hospitalisation spell,
where an episode is a period of time, within a hospitalisation spell,
in which the patient is under the care of an identifiable health care team.
Datasets with no primary key may contain the primary key variables of other datasets
as a foreign key,
but do not have a key of variables uniquely identifying the observations.

Examples

The following examples assume that the current folder has a sister folder ../cprdhesdata,
containing a tab-delimited data file hes_patient_18_109_Request4.txt,
with the correct variables for a CPRD HES patient dataset.

. cprdhes_patient using "../cprdhesdata/hes_patient_18_109_Request4.txt", clear

. cprdhes_patient using "../cprdhesdata/hes_patient_18_109_Request4.txt", clear nokey

Author

Roger Newson, Imperial College London, UK.

Email: r.newson@imperial.ac.uk

Also see

Help: Clinical Practice Research Datalink (CPRD)

cprdutil, cprdlinkutil, keyby, chardef, lablist if installed