Bootstrap sampling from a long formatted file

Accepted Solution Solved
Reply
Regular Contributor
Posts: 180
Accepted Solution

Bootstrap sampling from a long formatted file

Hello all,

 

I have a long formatted file, in which every subject has more than one row. For each row, I have several variables, two of them are "ID" and "Visit". Each subject has 5 visits. I have 50 subjects.

 

I want to make a random sampling with replacement, in order to get a larger file, with 100 subjects.

 

The problem is, when I use PROC SURVEYSELECT (which is straightforward), SAS chooses rows, not subjects. I want SAS to sample a subject, and to keep all his rows, rather than randomly selecting rows.

 

Can it be done ? I am pretty much lost here.

 

Thank you.


Accepted Solutions
Solution
‎01-27-2016 03:07 AM
Respected Advisor
Posts: 3,786

Re: Bootstrap sampling from a long formatted file

  • SAMPLINGUNIT | CLUSTER variables < / options > ;

View solution in original post


All Replies
Super User
Posts: 7,380

Re: Bootstrap sampling from a long formatted file

Have you already tried to use proc transpose to reformat the file into rows?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Regular Contributor
Posts: 180

Re: Bootstrap sampling from a long formatted file

No. I have too many variables per visit (10 variables * 5 visits will give 50 variables wide).
Regular Contributor
Posts: 180

Re: Bootstrap sampling from a long formatted file

I have an idea. Can I save the number of times each subject is selected, and then build different datsets for subjects with number of hits of up to 1, up to 2, etc... and then append these datasets ?

Solution
‎01-27-2016 03:07 AM
Respected Advisor
Posts: 3,786

Re: Bootstrap sampling from a long formatted file

  • SAMPLINGUNIT | CLUSTER variables < / options > ;

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 300 views
  • 2 likes
  • 3 in conversation