Skip to main content


Showing posts from February, 2016

Recency, Frequency, Monetary (RTF) variable generation using Danish National Health Register data.

Description Below adaptable SAS code for generation of recency, frequency and monetary variables.
Algorithm may be applied in a lot of contexts in which records contain dates ('day of entry', 'day of exit', 'day of visit') id number and maybe even revenue or cost.

Citation Please cite this code as:
Laier, G.H. (2016) Recency, Frequency and Monetary SAS programming script  [computer software]. Denmark. Link:

Gunnar Hellmund Laier,
PhD, MSc

Explanation In this context we form variable for analyses of Danish National Register data and form variables containing information on contacts, hospitalizations and days in hospital 14, 30, 91 and 180 days before a hospitalization or contact.

Key variables:
cpr (security number), pattype (patient type, in- or outpatient), inddto (day of entry), uddto (day of exit), ambdto (day of visit).

Data step program data calc.RFMdata(drop=dto_h…

Statistics site collection

General recommendations and programming examples: (syntax lookup) (combined best-practice/examples)

Emphasize on applications within psychology: (development of R-package, documentation) (several small GUIs and dokumentation)

Structural equation modelling (both variance and covariance based): (with link to smartPLS) (HTMT criterion)