Friday, October 23, 2020

Randomly Select a Subset from a Population Using SAS Proc Surveyselect and Dividing a Population into Multiple Subsets Using SAS Proc Rank

During a clinical trial, sometimes, we are asked to select a subset of subjects from all trial participants. For example, for a clinical trial with 500 subjects enrolled, we need to select randomly 10% of subjects to do quality control (i.e., select 50 subjects from total of 500 enrolled subjects.

This can be easily accomplished by using SAS Proc Surveyselect. The full SAS manual about Proc SurveySelect can be found here.

Proc surveyselect data=AllEnrolled method=srs n=50 out=random50;
Run;
Proc print data=random50 noobs;
Var SubjectID;
run;

During the statistical analyses especially the posthoc analyses, we may be asked to perform subgroup analyses by median (2 groups), tertiles (3 groups), quartiles (4 groups). For example, we may want to do a subgroup analysis of treatment comparison by baseline BMI where subjects are split into three groups (tertiles) with an equal number of subjects in each subset. This can be easily implemented by using SAS Proc Rank.

Proc Rank data=allEnrolled group = 3 out=test;
var BMI;
ranks rank_BMI;
run;
proc print data=test;
run;

The full SAS manual about Proc Rank can be found here. Two papers from SAS blogs discussed this related issue. 

No comments: