i have a dataset with 100000 records. i want 100 records
from that dataset and create a dataset.we need to pick the
observations random order like
100obs,500obs,1020obs,1890obs,2565obs like that i need 100
obs in random order? how can we create this one?

Answers were Sorted based on User's Feedback



i have a dataset with 100000 records. i want 100 records from that dataset and create a dataset.we ..

Answer / solasa

we can use PROC SURVEY SELECT

Is This Answer Correct ?    8 Yes 2 No

i have a dataset with 100000 records. i want 100 records from that dataset and create a dataset.we ..

Answer / dilip

data A;
do slice = 100,500,1890,256,...100th;
set source point=slice;
output;
end;
stop;
run;

Is This Answer Correct ?    6 Yes 0 No

i have a dataset with 100000 records. i want 100 records from that dataset and create a dataset.we ..

Answer / sasuser

Hi Guys,
I slightly modified Dilip's answer.
I took Sashelp.shoes as the input dataset.
Following is the solution.
data A;
do i=1 to 100;
k=int(51*ranuni(2)+1);
do slice = K;
set sashelp.shoes point=slice;
output;
end;
end;
stop;
drop i k;
run;

Is This Answer Correct ?    1 Yes 0 No

i have a dataset with 100000 records. i want 100 records from that dataset and create a dataset.we ..

Answer / pratik

data datasetname;(where you want create new dataset)
set datasetname1;(in which you have 100000 records)
if _N_(100,500,1020,1890,2565);
run;
proc print data=datasetname;
run;

Is This Answer Correct ?    0 Yes 1 No

i have a dataset with 100000 records. i want 100 records from that dataset and create a dataset.we ..

Answer / suri

1)data ds2;
do i=100,1020,1890,2565;
set ds1 point=i;
output;
end;
stop;
run;

2)data ds2;
set ds1;
where _n_ in(100,1020,1890,2565);
run;

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More SAS Interview Questions

which features do you use to check the data validations and errors? : Sas-administrator

0 Answers  


what is ae onset date n what is RDS

0 Answers   Accenture,


hi tell be about pfizer? how to compare the work with other companies ? please tell me how to login and work also?

0 Answers   Pfizer,


What are all the problems you faced while validating tables and reports?

0 Answers   Accenture, Quintiles,


List down the reasons for choosing sas over other data analytics tools.

0 Answers  






In PROC PRINT, can you print only variables that begin with the letter “A”?

8 Answers  


What is a macro routine?

0 Answers  


What is a method for assigning first.VAR and last.VAR to the BY group variable on unsorted data?

0 Answers   Quintiles,


Explain append procedure?

0 Answers  


What is the significance of the ‘OF’ in X=SUM (OF a1-a4, a6, a9);?

8 Answers  


What are pdv and it functions?

0 Answers  


How would you remove a format that has been permanently associated with a variables?

3 Answers  


Categories