You have a data set of 100 observations,how can you
restrict the output so that the output has only data from
row no. 10 to row no. 20
Answers were Sorted based on User's Feedback
Answer / reema
For that u have to use fistobs and obs both.
Eg:- firstobs 10 obs 20
Firstobs :- Will start observing from the row 10 ..
Obs:- will show till 20th observation .
Is This Answer Correct ? | 21 Yes | 3 No |
Answer / shambhu verma
Options firstobs=10 obs=20;
proc print data= sas data set;
run;
Is This Answer Correct ? | 9 Yes | 0 No |
Answer / amit gupta
SELECT *
FROM (SELECT ROWNUM srno, a.*
FROM emp a)
WHERE srno >= 10 AND srno <= 20
/
SELECT *
FROM (SELECT ROWNUM srno, a.*
FROM emp a)
WHERE srno between 10 and 20
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / suri
output window
1)proc print data=ds1(firstobs=10 obs=2);
run;
2)data ds1;
set ds(firstobs=10 obs=20);
run;
3)data ds1;
set ds;
where _n_ in(10:20);
run;
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / jonathan o&
data Subset;
set whatever;
if _N_ not in (10-20) then delete;
run;
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / monika
Data test;
input a 8. @@;
datalines;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
;
run;
Data Result;
Set test(firstobs=10 obs=20);
Run;
Proc print data = Result;
Run;
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / dharani
Corection to Reema's answer :
Eg:- firstobs 10 obs 10
Firstobs :- Will start observing from the row 10 ..
Obs:- will show total 11 observations .from 10 - 20
Is This Answer Correct ? | 1 Yes | 5 No |
Answer / xxxx
Corection to Reema's answer :
Eg:- firstobs 10 obs 10
Firstobs :- Will start observing from the row 10 ..
Obs:- will show total 10 observations .from 10 - 20
Is This Answer Correct ? | 1 Yes | 7 No |
why is a stop statement needed for the point=option on a set statement? : Sas programming
What SAS statements would you code to read an external raw data file to a DATA step?
What are exact SAS Base contents..?N what r SAS Tools..?
/*i have the following dataset.*/ data score; input marks ; datalines; 10 20 30 40 50 60 70 80 90 100 ; run; Now i should get the result as sum of 1 to 5 i.e(10+20+30+40+50)=150 and 2 to 6 i.e(20+30+40+50+60)=200 and 3 to 7 i.e(30+40+50+60+70)=250 and so on. how to get it. thanks in advance
Explain bmdp procedure?
how does sas handle missing values in sort order? : Sas programming
what are the scrubbing procedures in sas? : Sas programming
What other SAS features do you use for error trapping and data validation?
What is by-group processing?
how can you sort the dataset having millions of OBS(instead of sort procedure?
. Which date advances a date, time or date/time value by a given interval?
How could i automate the code in the scenario:Every month one new data set will be created for that perticular month transaction list.Now i would like to update the data in the source table by appending every month data automatically. jan---set jan; feb---set jan feb; mar---set jan mar;