Hi, on page 85 of the official SAS specialist prep guide, there is an example showing us how to use firstops and obs option in the proc print step that will override the system options.
There are only 20 observations in heart file. So when they use firstobs=20 obs=30, only one observation is produced, is that a typo because they said to produce the same output (6 observations) or am I misunderstanding the intention of the author?
heart.sas7dbat attached if you want to have a look at the file.
@Nietzsche wrote:
is that a typo because they said to produce the same output (6 observations) or am I misunderstanding the intention of the author?
IMHO it makes only sense the other way round. 20 and 30 in the options statement and 10 and 15 in the options of the data set. That would demonstrate that defaults are overwritten ... and came up with the same results as the previous code segment.
Just my 2ct
Fja
@Nietzsche wrote:
is that a typo because they said to produce the same output (6 observations) or am I misunderstanding the intention of the author?
IMHO it makes only sense the other way round. 20 and 30 in the options statement and 10 and 15 in the options of the data set. That would demonstrate that defaults are overwritten ... and came up with the same results as the previous code segment.
Just my 2ct
Fja
Bad phrasing. It would have been better to put the 20/30 combination into the OPTIONS statement and then override that with the original 10/15.
Or make it clear that the result will be the same effect, but with a different outcome.
That's not bad just phrasing, it's bad logic/code.
Think the author was having a mental lapse went he wrote that code given he used the wrong library in the same code as well, hopefully SAS institute will put that into their official Errata (aka update)
They just left out explicitly showing all three combinations.
Seems very clear to me.
The point (as highlighted by the TIP) is that the dataset options OVERRIDE the system options.
The fact that the dataset referenced does not match the datasets in the course is a minor annoyance. (It is also an added learning opportunity. You need to build up you ability to translate example code to your situation).
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.