BookmarkSubscribeRSS Feed
amoynahan
Calcite | Level 5

I want to create 5000 bootstrap samples from patient level data stratified by treatment and with a MAIC weight.

 

My question are: 1) How to sample using proc surveyselect using a weight, 2) when you use one of the samples in proc lifereg do you use the original weight, or assume that the weight in now incorporated into the sample though the weighting procedure

 

I use the method pps_wr in proc surveyselect, and using the weight with the size option.


data patients;
  length treatment $10;
  set os;
  keep usubjid treatment weight;
run;

 

proc sort data=patients;
  by treatment usubjid;
run;

 

proc sql;
  create table sampsize as
  select treatment, count(*) as _nsize_
    from patients
    group by treatment;
quit;

 

proc surveyselect data=patients(keep=usubjid treatment weight)
  out=patients_samples(keep=sample usubjid treatment weight)
  sampsize=sampsize
  method=pps_wr
  reps=5000(repname=sample)
  seed=8675309
  outhits noprint;
  strata treatment;
  size weight;
run;

 


data os_samples;
  merge os (in=a keep=usubjid time event weight)
  patient_samples(in=b);
  by usubjid;
  if a and b;
run;

 

proc sort data=os_samples;
  by sample usubjid;
run;

 

/*** For this last 

 

/* Note: I'm actually using flexsurv in R at this point */

proc lifereg data=os_samples;

  by sample;

  class treatment;
  model time*event(0) =treatment / distribution = weibull;

  weight weight; /* Should this statement be included ? */
run;

 

So again, should this weight statement be included in samples that were created with the weight, or should it be dropped at this point?

 

2 REPLIES 2
Rick_SAS
SAS Super FREQ

It looks like you are using the WEIGHT variable to select observations. If so, you do not need it in PROC LIFEREG.

 

In general, when you bootstrap, you are trying to discover how a point estimate in an analysis varies in random samples. You start with an analysis. The BY statement runs the same analysis on a collection of similar random data (the resamples). So, with the exception of the BY statement, your PROC LIFEREG statements should look exactly the same as in the original analysis. So if your original PROC LIFEREG statement does not have a WEIGHT statement, neither should your bootstrap analysis.

amoynahan
Calcite | Level 5

Thank you for the reply. It makes sense. Once you use the weight statement to do the sample, the weights are baked into the composition of the new sample.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 506 views
  • 1 like
  • 2 in conversation