How to select the observations randomly from a SAS dataset

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you explain the process of calendar?

648


If a variable contains only numbers, can it be a character data type?

616


Mention the category in which sas informats are placed?

637


What is the differnce between SDTM 3.1.2 to 3.1.1 version

4621


Can you execute a macro within a macro? Describe. : sas-macro

681






Are you sensitive to code walk-throughs peer review or QC review?

2615


What is the SAS data set?

681


what is SAS OPTIMIZATION?

1819


what is PhaseIII, ODS, TLG, Macro and Proc in SAS

3913


What is the sas data set? : sas-grid-administration

578


What is the basic syntax of a sas program?

673


what does the run statement do? : Sas programming

562


what are input dataset and output dataset options? : Sas programming

571


why is a stop statement needed for the point=option on a set statement? : Sas programming

594


What is the difference between reading data from an external file and reading data from an existing data set?

641