Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to select the observations randomly from a SAS dataset

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the use of proc print and proc contents?

958


What is the difference between the proc sql and data step?

1170


Differentiate between ceil and floor functions.

1153


What are the different servers in sas? : sas-grid-administration

1053


what is the difference between: x=a+b+c+d; and x=sum (of a, b, c ,d);? : Sas programming

1138


Describe the function and utility of the most difficult SAS macro that you have written?

2559


Difference between SAS STATA & SPSS?

1112


what is SAS OPTIMIZATION?

2287


what are the types of interactive display types? : Sas-bi

1092


What are the limitations for memory allocation for SAS variables

1483


How to specify variables to be processed by the freq procedure?

1069


List out some key concept of SAS

1120


which date function advances a date, time or datetime value by a given interval? : Sas programming

1042


What is factor analysis?

1130


what are the scrubbing procedures in sas? : Sas programming

1278