I'm not using a strata statement because this is part of
a macro (see below). I loop through the macro once for each hospital. It works great if the hospital has enough patients to select the full random sample. If I need 25, but there are only 21 patients to select, then the code fails.
I need something that allows me the request 25 or all available.
Thanks for your input. I'm really stuck!
Sheri
%MACRO MSELECT(DSNIN,COMP,DSNOUT,SampSize,Frequency,Title2);
data HMASelect (drop=Company);
set &DSNIN;
if Company="&COMP";
run;
proc surveyselect data=HMASelect
n=&SampSize
method=srs
out=&DSNOUT;
run;
ODS PDF FILE="L:\Production\HMASamples\&DSNOUT..PDF";
proc print data=&DSNOUT split='*';
label Patient_Last_Name = 'Patient*Last*Name'
DischargeDate = 'Discharge*Date'
Patient_First_Name = 'Patient*First*Name';
var DCYrMonth AdvEncNo DischargeDate Patient_Last_Name Patient_First_Name;
format DischargeDate MMDDYY10.;
Title "&COMP - &Frequency Random Sample of Inpatient Encounters with an HMA Attending Physician";
title2 "&TITLE2";
FOOTNOTE "http://ftwweb07/HMFWOutcomes/HMA/SharedDocuments
";
run;
proc delete data=HMASelect;
run;
ODS PDF CLOSE;
%MEND MSELECT;
%MSELECT(Report1,HAR,HAR_MTH_Attending_Sample,25,Monthly,DVT - Lipi