shlogg · Early preview
Judy @esproc_spl

Extracting Medical History With SPL Code For SAS System

Retrieve data from SAS, sort by Visit_code & Date. Group by Id, create new table with Office_Visit=1 if consultation after surgery, SX_past_6mo=1 if 6 months later.

In the sas system, table tab stores the patients’ medical history. Visit_code=Surgery means that the patient is in surgery; Visit_code=Office means the patient is in consultation room. Each patient has more than one Visit_code; one may only have Surgery or Office. Below is the table:

Task: Get the historical medical status for each patient. If they once got consultation, record Office_Visit as 1 (Office_Visit=1), otherwise record it as 0; if they got consultation six months after their surgery, record SX_past_6mo as 1 (SX_past_6mo=1), otherwise record it as 0:

Write the following SPL code:...