How to select the observations randomly from a SAS dataset

Answers were Sorted based on User's Feedback



How to select the observations randomly from a SAS dataset..

Answer / srinath

Proc surveyselect;
this gives the random selection of observations.

Is This Answer Correct ?    23 Yes 1 No

How to select the observations randomly from a SAS dataset..

Answer / learner

By using ranuni function. for example you want select 30
percent of data randamly from a data set.

data x;
set y;
if ranuni(100)<.3 ;
run;

here 100 is the seed. the number generated depends on this
seed .

Is This Answer Correct ?    11 Yes 1 No

How to select the observations randomly from a SAS dataset..

Answer / srikanth

you can use the RANUNI function to select observations
randomly.

Ex:-

data test;
input number @@;
cards;
2.1 3.1 4 6 2.2 4.9 4 5 3 3.3 4 5 3 4.3 5 7 3 3 9 11
;

data test1;
set test;
random=ranuni(1);
run;

%let k=10;

PROC SORT DATA=TEST1;
BY random;/*SORT OBSERVATIONS*/
run;

DATA TEST2;
SET TEST2 (DROP=RANDOM);
IF _N_ LE &K;
RUN;

PROC PRINT ;
RUN;

Is This Answer Correct ?    8 Yes 6 No

How to select the observations randomly from a SAS dataset..

Answer / neel

By using the point function

Is This Answer Correct ?    1 Yes 1 No

How to select the observations randomly from a SAS dataset..

Answer / chowdary vamsi

using rununni function generate random sample observations

Is This Answer Correct ?    0 Yes 0 No

How to select the observations randomly from a SAS dataset..

Answer / name is no need

I think by using mod operator we can select the random
observations.
syntax:mod(_n_,number);

Is This Answer Correct ?    5 Yes 6 No

How to select the observations randomly from a SAS dataset..

Answer / ram

by using proc sort.

Is This Answer Correct ?    2 Yes 18 No

Post New Answer

More SAS Interview Questions

how to remove the duplicates by proc sql?

2 Answers   Genpact,


I have a dataset with variables empid and doj how to calculate retirement age?

1 Answers  


What is your weekness? I am confuse what to say about this question. so can u give some answer which can be yur strenght.

1 Answers   Cipla,


What SAS statements would you code to read an external raw data file to a DATA step?

10 Answers   NIIT,


what is sas? is a package or tool? give me introduction about sas?

11 Answers   Accenture,






how to perform paired t-test using Base/SAS & SAS/Stat?

2 Answers  


What is the basic syntax of a sas program?

0 Answers  


i have a null dataset with 20 variables. i want to upload the variables which contain name like a or k or anything in another dataset.how can we create the dataset?

3 Answers   L&T,


How to display duplicate observations in data?

1 Answers  


"What is the difference between proc sort nodup and proc sort nodupkey?"

2 Answers  


where to use sas business intelligence? : Sas-bi

0 Answers  


data voter; input Age Party : $1. (Ques1-Ques4)($1. + 1); datalines; 23 D 1 1 2 2 45 R 5 5 4 1 67 D 2 4 3 3 39 R 4 4 4 4 19 D 2 1 2 1 75 D 3 3 2 3 57 R 4 3 4 4 ; Idont understand what the (Ques1-Ques4)($1. + 1) means. I have seen (Ques1-Ques4)(4*$1.), but what is (Ques1-Ques4)($1. + 1)? Appreciate all help Thanks

3 Answers  


Categories