Section Progress
0% Complete

Step 2: Trimming the cohort

Next, trim the areas of no-overlap in the cohort. First try doing this on your own using the simulated data sets.

Reveal example code below if you need a hint or want to check your work.

Example code (click to reveal)

proc sort data=ps_out;
  by exposure;
run;

proc univariate data=ps_out noprint;
  var ps;
  by exposure;
  output out=ps_range min=min max=max;
run;

data _null_;
  set ps_range;
    if exposure=1 then do;
    call symput("min_exposed",min);
    call symput("max_exposed",max);
  end;
    else do;
    call symput("min_unexposed",min);
    call symput("max_unexposed",max);
  end;
run;

data ps_trim;
  set ps_out;
  if ps >= max(&min_exposed,&min_unexposed) and ps <= min(&max_exposed,&max_unexposed);
run;