BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Nietzsche
Lapis Lazuli | Level 10

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_1-1667646276436.png

 

 

SAS Base Programming (2022 Dec), Preparing for SAS Advanced Programming (Cancelled).
1 ACCEPTED SOLUTION

Accepted Solutions
fja
Lapis Lazuli | Level 10 fja
Lapis Lazuli | Level 10

@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

View solution in original post

5 REPLIES 5
fja
Lapis Lazuli | Level 10 fja
Lapis Lazuli | Level 10

@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

Kurt_Bremser
Super User

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.

Nietzsche
Lapis Lazuli | Level 10

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)

SAS Base Programming (2022 Dec), Preparing for SAS Advanced Programming (Cancelled).
Tom
Super User Tom
Super User

They just left out explicitly showing all three combinations.

Tom_0-1667659466344.png

 

Tom_0-1667659687366.png

 

 

Tom
Super User Tom
Super User

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 877 views
  • 3 likes
  • 4 in conversation