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

Name few SAS functions?

664


Do you need to rearrange the order of the data for the report?

1830


How do you use the do loop if you don’t know how many times you should execute the do loop?

749


What is a pdv and what are its functions?

598


What are the difference between the sas data step and sas procs?

606






For a user to have access to a standard workspace server, is internal authentication alone is sufficient? : sas-grid-administration

533


What is the difference between order and group variable in proc report?

833


hi here is a problem can anybody solve this? i want to report the data through third party file. by using data _null_ or proc report or macro automation process. but i want to insert the 'titles and footnotes' in between the data and also starting of 2nd and ending of 2nd and starting of 3rd and ending of the 3rd page. tell me how and write the code?

1684


what is the one statement to set the criteria of data that can be coded in any step? : Sas programming

646


What are pdv and it functions?

596


Explain append procedure?

630


What is the function of output statement in a SAS Program?

606


What is the maximum length of the macro variable? : sas-macro

617


What is the SAS data set?

675


Explain the main difference between the sas procedures and functions? : Sas-administrator

533