BookmarkSubscribeRSS Feed
zhongdianshi
Calcite | Level 5

We have physician data with taxID and need to split them equally to two groups. We want to keep the physicians together under same taxID.

First, we use the below coding to assign 0 and 1 based on taxID.

proc surveyselect data=test samprate=0.50 seed=49201 out=Sample outall

           method=srs noprint;

        run;

Then, they ask whether we could have a list which also consider the size of taxID(the physicians number), because each taxID have a vary number of physicians. For example, they probably have 1 physician or 20 physicians under each taxID.

So, the current question is how to split all of the taxID to 2 groups randomly, which also make sure they have similiar amount physicians under each group.

Thanks,

Kui

5 REPLIES 5
ballardw
Super User

Do you want a sample of physicians or of TaxIds?

zhongdianshi
Calcite | Level 5

sample of taxID. And also consider the number of physicians under the taxID

Thanks,

Kui


zhongdianshi
Calcite | Level 5

If I sort taxID by number of physician, then randomly assign them to two groups, I guess, they might have similar physician number.

ballardw
Super User

Technically putting another requirement on the resulting sample changes the "random selection" behavior you may have chosen. One approach would be to have a summary of the TaxId with the number of physicians at each. Select a sample of TaxIds in your groups/strata what ever. Examine the sum of physicians. If the number is too far apart, rerun the sample until you get something "close enough". But you are playing somewhat loose with the probability of selection and resulting weights.

zhongdianshi
Calcite | Level 5

Thanks for your time and suggestions.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1291 views
  • 0 likes
  • 2 in conversation