Help using Base SAS procedures

Finding the last observation

Reply
Regular Contributor
Posts: 229

Finding the last observation

Hi

I am having a dataset but i dont know th no of obs are there now i want the last obs.Is there any option.
SAS Employee
Posts: 160

Re: Finding the last observation

Data lastobs;
set sashelp.class end=last;
if last then output;
run;
Super Contributor
Super Contributor
Posts: 3,174

Re: Finding the last observation

With the DATA step approach, there are SET statement options NOBS= and POINT= for this use - sample shown below.

Scott Barry
SBBWorks, Inc.

data _null_;
set sashelp.class nobs=obscount point=obscount;
putlog _all_;
stop;
run;
Ask a Question
Discussion stats
  • 2 replies
  • 107 views
  • 0 likes
  • 3 in conversation