OPTIONS OBS & FIRST OBS
Problem: I have a dataset ‘MYDATA’ which has 1000 observations. I perform the following operations on it.
OPTIONS FIRSTOBS = 5 OBS =20;
PROC SORT DATA = MYDATA_OBSERVATIONS OUT =MYDATA_OBSERVATIONS_SORTED;
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);
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
555 OPTIONS FIRSTOBS = 5 OBS =20;
556 PROC SORT DATA = MYDATA_OBSERVATIONS OUT =MYDATA_OBSERVATIONS_SORTED;
557 BY ACCOUNTMANAGERCODE;
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.