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

Are you involved in writing the inferential analysis plan? Tables specifications?

0 Answers   Oracle,


Name statements that function at both compile and execution time.

3 Answers   L&T,


Hi, I need to create a SAS Map of USA using SAS Graphs(Proc Gmap).The data i have dosent contain any co-ordinates of USA cities or counties or states, and the zip codes are diffrent in the data i have from the zip code in the Maps.US dataset in the Maps Library for SAS MAPS. the data i have is a sales report. i have to generate the maps according to the states,cities aligned in the sales data, HELP Appriciated

1 Answers  


why only we use SAS? their r many programmin language like SPSS, Oracle... Why SAS?

2 Answers   Accenture,


how to display duplicated observations in a data using base sas.

13 Answers   HCL, TCS,






Hi, I have one dataset, could you please ans for this. id amount paid_amount 1 700 400 2 900 250 3 300 300 a 400 250 b 500 320 c 800 650 x 200 190 y 900 250 z 300 180 i want create new dataset having id and paid_amount who are paid high amount comparing amount. ex: 1d paid_amount 3 300 c 650 x 190

3 Answers  


what does .. meant in sas macros

3 Answers   D&B,


Mention few ways with which a “table lookup’ is done in sas programming.

1 Answers  


Code the MEANS to produce output to be used later.

2 Answers  


How can you create a macro variable with in data step? : sas-macro

0 Answers  


Explain the special input delimiters used in sas programming.

0 Answers  


what is incremental update ? is this possible in SAS OLAP CUBE STUDIO.

1 Answers   TCS,


Categories