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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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