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

How many data types are there in SAS?

1078


what do the sas log messages "numeric values have been converted to character" mean? : Sas programming

1034


what is data integration? : Sas-di

1120


which date functions advances a date time or date/time value by a given interval? : Sas programming

959


Explain the use of proc gplot? : sas-grid-administration

988


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

2568


What versions of SAS have you used (on which platforms)?

1518


what are the categories that sas informats are used to the place the data? : Sas-administrator

1053


How can sas program be validated?

1037


Name some categories in sas 9? : sas-grid-administration

978


If you have a dataset that contains 100 variables, but you need only five of those, what is the code to force SAS to use only those variables?

1165


what is change analysis in sas di ? : Sas-di

1060


Mention the validation tools used in SAS?

1181


please can you tell me that in companies sas work are doing by through sas coding or sas wizard ??

2102


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

1099