BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
desireatem
Pyrite | Level 9

Hello The simple random code with replacement usually produce output with hits number, for instant id 22 is chosen three times. However I do not want the output like that , I want all the three hit live in the second output. That I want the sample size to stay 10, even if it is not independent like in output two below.

proc surveyselect data = hsb25 method = SRS rep = 1

  sampsize = 10 seed = 12345 out = hsbs1;

  id _all_;

run;

proc print data = hsbs1 noobs;

run;

proc surveyselect data=hsb25  method = urs sampsize = 10
   rep=1 seed=12345 out=hsbs2 out=outhits;
   id id read write math science socst;
run;

proc print data = hsbs2 noobs;

run;

OUTPUT ONE

            Rep    id    re    wri   math    sc    soc     Hits

                  1        108     34       33      41        36        36        1

    1         50     50       59      42        53        61        1
    1        102     52       41      51        53        56        1
    1        136     65       59      70        63        51        1
    1        171     60       54      60        55        66        1
    1         22     42       39      39        56        46        3
    1         47     47       46      49        33        41        1
    1         56     55       45      46        58        51        1

Hello The code above gives the output of Simple random sampling with replacement.  The sample size is 10. However I am not happy with the way the data is reported. I want the Hits= 3 to be reported three times. I wish to ask if any knows how to help me report the data like this:

OUTPUT TWO
      Rep    id    re    wri   math    sc    soc     Hits
 
    1        108     34       33      41        36        36        1
    1         50     50       59      42        53        61        1
    1        102     52       41      51        53        56        1
    1        136     65       59      70        63        51        1
    1        171     60       54      60        55        66        1
    1         22     42       39      39        56        46        1
    1         22     42       39      39        56        46        1
    1         22     42       39      39        56        46        1
    1         47     47       46      49        33        41        1
    1         56     55       45      46        58        51        1
1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Add option OUTHITS to the Proc Surveyselect statement. - PG

PG

View solution in original post

2 REPLIES 2
PGStats
Opal | Level 21

Add option OUTHITS to the Proc Surveyselect statement. - PG

PG

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 374 views
  • 0 likes
  • 2 in conversation