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

Mention what is the difference between nodupkey and nodup options?

1009


What is the basic syntax style in SAS?

1166


how can you import .csv file in to sas? : Sas programming

1098


hi all, I need the SAS DI DUMP(A00 260) for attending the certification. if any one have, pls provide it.Please Email to vrpotluri@hotmail.com. Thanks - Ramana

5447


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

1057


How many data types are there in SAS?

1078


for what purpose would you use the retain statement? : Sas programming

1096


how do you debug and test your sas programs? : Sas programming

1124


What is the work of tranwrd function?

1246


what are the new features included in the new version of sas i.e., Sas 9.1.3? : Sas programming

1078


Explain what Proc glm does?

1212


What are the five ways to do a table lookup in sas? : sas-grid-administration

1062


How does SAS handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, PROCs?

1537


what is intially documentation in sas?

5052


Explain input and put function?

1142