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

What is the difference between input and infile statement?

1224


What are pdv and it functions?

1239


What is the use of PROC gplot?

1202


How we can call macros with in data step? : sas-macro

1175


What are symget and symput? : sas-macro

1366


Describe a time when you were really stuck on a problem and how you solved it?

2678


How to limit decimal places for the variable using proc means?

1120


how does sas handle missing values in a merge? : Sas programming

1095


What are the difficulties u faced while doing vital signs table or dataset?

2446


Explain by-group processing?

1037


Difference between SAS STATA & SPSS?

1176


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

1249


Why and when do you use proc sql?

1285


how does sas handle missing values in sort order? : Sas programming

978


What is PROC in SAS?

1100