how do i get last 10obs from a dataset when we don't know
about the number of obsevations in that dataset?

Answer Posted / pratik

Suppose we have dataset like sasuser.admit.

we dontknow how many obs are there in this dataset.

then we can use
Proc contents data=sasuser.admit n;
run;
it will come the total no of obs in this dataset.

after doing this you will get 21 obs are there.

data dsn1;
set sasuser.admit(firstobs=12 obs=21);
run;
proc print data=dsn1;
run;
then you will get last 10 obs.

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a method to debug and test your SAS program?

726


what versions of sas have you used (on which platforms)? : Sas programming

587


What is run-group processing?

628


Name few SAS functions?

670


Explain what is data step?

731






This entry was posted in General. Bookmark the permalink. Post a comment or leave

4054


How to specify variables to be processed by the freq procedure?

619


What is the difference between proportion and average?

2761


Differences between where and if statement?

586


List out some key concept of SAS

625


What is maximum storage capability of SAS?

909


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

614


If you use a symput in a data step, when and where can you use the macro variable? : sas-macro

613


explain the concepts and capabilities of business object? : Sas-bi

545


what is hash files in sas and why we are using this one in sas?

1734