SAS- Problem-3:OPTIONS OBS & FIRST OBS
Posted by Analyst in SAS, SAS-OBS, SAS-Options, SAS-Programming, SAS-questions
You are here: Home > SAS-questions > SAS- Problem-3:OPTIONS OBS & FIRST OBS
on Aug 4, 2009OPTIONS OBS & FIRST OBS
Problem: I have a dataset ‘MYDATA’ which has 1000 observations. I perform the following operations on it.
OPTIONS OBS=MAX;
DATA MYDATA_OBSERVATIONS;
SET MYDATA(OBS=100);
RUN;
OPTIONS FIRSTOBS = 5 OBS =20;
PROC SORT DATA = MYDATA_OBSERVATIONS OUT =MYDATA_OBSERVATIONS_SORTED;
BY MANAGERCODE;
RUN;
PROC PRINT DATA = MYDATA_OBSERVATIONS_SORTED;
How many observations will get printed after this process?
Solution: Here’s the log for this code.
569 OPTIONS OBS=MAX;
570 DATA MYDATA_OBSERVATIONS;
571 SET MYDATA(OBS=100);
572 RUN;
NOTE: There were 100 observations read from the data set WORK.MYDATA.
NOTE: The data set WORK.MYDATA_OBSERVATIONS has 100 observations and 22 variables.
NOTE: DATA statement used (Total process time):
real time 0.06 seconds
cpu time
555 OPTIONS FIRSTOBS = 5 OBS =20;
556 PROC SORT DATA = MYDATA_OBSERVATIONS OUT =MYDATA_OBSERVATIONS_SORTED;
557 BY ACCOUNTMANAGERCODE;
558 RUN;
NOTE: There were 16 observations read from the data set WORK.MYDATA_OBSERVATIONS.
NOTE: The data set WORK.MYDATA_OBSERVATIONS_SORTED has 16 observations and 22 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.17 seconds
cpu time 0.12 seconds
So 16 observatioins will be printed, this is because first OBS=20 is takenand then SAS will start reading from the 5th observation.
PEOPLE WHO READ THIS ALSO READ : SAS,
SAS-OBS,
SAS-Options,
SAS-Programming,
SAS-questions
This entry was posted on Aug 4, 2009 at 4:43 PM and is filed under SAS, SAS-OBS, SAS-Options, SAS-Programming, SAS-questions. You can follow any responses to this entry through the RSS 2.0. You can leave a response.
If you liked this post, make sure you subscribe to the RSS feed!



SAS
XCELSIUS






# by Kiran - October 4, 2009 9:03 PM
is there a way to delete the last observation of a dataset...?