Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- Re: how to get sampled output data without sorting

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 10-26-2015 05:09 PM
(966 views)

Hi, every one.

Recently, I am trying to select some sample using PROC SURVEYSELECT procedure.

I want to give the sequence the obeservtion, for example, the I have 5 observation, 1 to 5.

the sequecne for sampling without replacement may be is 3 5 4 1 2.

but, everytime the sas only give me the output data which has been sorted.

so, i only can have a data set is 1 to 5.

I check the statement, the sort statement also does not provide the function I asked.

if there is a easy way to get the results I want?

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

if you want your sample to appear in random order, you must generate the permutation yourself. For example:

```
data test;
call streaminit(76575);
do x = 10 to 1 by -1;
order = rand("UNIFORM");
output;
end;
run;
proc surveyselect data=test out=sample5 sampsize=5 seed=866787;
run;
proc sort data=sample5 out=sample5(drop=order); by order; run;
```

PG

3 REPLIES 3

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

You should post some code and what your input data looks like and what you expect.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

if you want your sample to appear in random order, you must generate the permutation yourself. For example:

```
data test;
call streaminit(76575);
do x = 10 to 1 by -1;
order = rand("UNIFORM");
output;
end;
run;
proc surveyselect data=test out=sample5 sampsize=5 seed=866787;
run;
proc sort data=sample5 out=sample5(drop=order); by order; run;
```

PG

⏰

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.** **

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.