Visit Windowing

Introduction

When representing the summaries of data by visit, we either consider visits from raw data or by analysis visits. These analysis visits may be subjected to visit windowing algorithm.

Visit window algorithm has two components:

1)Specifying the visit window range for each visit.

2)Find the unique visit from all the visits that fall in the particular visit window range.

Input Data:

Consider the following dataset from study with single treatment group Treatment A.

and the visit window range is as follows:

Algorithm 1:

  1. We need to select the records for ady between the ranges.
  2. The unique visit selection is specified in SAP. Most of the cases it will be the closest visit to the planned target study day.
  3. To find the closest visit we need to find the value for AWTDIFF, which is the difference between visit and target study day.
  4. While considering the closest visit (smallest AWTDIFF), there may be situations where two assessments have the same AWTDIFF. In such cases we take the last assessment.

Algorithm 2:

  1. If two or more assessments are taken on the same date or same date and time , that is, if there is a scheduled visit,re-test visit(for lab data) and an unscheduled visit on the same date and time, then we choose scheduled visit first, then re-test visit and then unscheduled visit. That is one with smallest raw visit number. 2.For this we may create a variable called VISTYP and give for example values 1 to 3 to scheduled visit, re-test visit and unscheduled visit. Different rules can be applied for the selection of analysis visit with visit windowing. In most cases, the above codes can be applied. For the raw visits that do not fall under the visit window range we may either set it to blank or give “Not Windowed”.

Sample Code:

1.

proc sql noprint;
  create table awind as
  select a.*, b.*
  from adam a left join windr b
  on awlo <= ady <= awhi;
quit;
  
data awt;
  set awind;
  if cmiss(ady,awtarget) =0 then awtdiff=abs(ady-awtarget);
run;
  
proc sort data = awt;
  by usubjid avisitn descending awtdiff ady;
run;
  
data analvisit;
  set awt;
  by usubjid avisitn descending awtdiff ady;
  if last.avisitn then anl01fl=”Y”; *We use ANL01FL to identify the records;
run;

2.

proc sort data=awt;
  by usubjid avisitn descending awtdiff ady descending vistyp descending visitnum;
run;

data analvisit;
  set awt;
  by usubjid avisitn descending awtdiff ady descending vistyp descending visitnum;
  if last.avisitn then anl01fl=”Y”; *We use ANL01FL to identify the records;
run;

Output:

1.

2.

back