SlideShare a Scribd company logo
46: NOBS for Noobs
David B. Horvath, CCP, MS
Presenter
The Author can be contacted at:
504 Longbotham Drive, Aston PA 19014-2502, USA
Phone: 1-610-859-8826
Email: dhorvath@cobs.com
Web: http://www.cobs.com/
LinkedIn: https://www.linkedin.com/in/dbhorvath/
All trademarks and servicemarks are the
property of their respective owners.
David B. Horvath, CCP, MS
Copyright © 2015-2021 David B. Horvath, CCP — All Rights Reserved
Abstract
This mini-session will be a short discussion of the NOBS (number of observations)
option on the SET statement.
This includes one "gotcha" that I've run into with where clauses: NOBS is set before
WHERE processing. If you have a reason to know the number of observations
after the WHERE clause, another DATA step is needed.
My Background
• David is an IT Professional who has worked with various platforms since the 1980’s with a
variety of development and analysis tools.
• He has presented at PhilaSUG, SESUG, and SGF previously and has presented workshops
and seminars in Australia, France, the US, Canada, and Oxford England (about the British
Author Nevil Shute).
• He holds an undergraduate degree in Computer and Information Sciences from Temple
University and a Masters in Organizational Dynamics from UPENN. He achieved the
Certified Computing Professional designation with honors.
• Most of his career has been in consulting (although recently he has been in-house) in the
Philadelphia PA area. He is currently in Data Analytics "Engineering" at a Regional Bank.
• He has several books to his credit (none SAS related) and is an Adjunct Instructor
covering IT topics.
Basic NOBS
• The nobs statement is a handy way of discovering how many
observations are in your SAS Dataset:
data simple;
a = 42;
output;
run;
data _null_;
put nobs=;
stop;
set simple nobs=nobs;
run;
• Prints
NOBS=1
Macro NOBS
• Great information if you need it!
• Is available before first row is processed
• Can be stored in macro variable for global usage:
data _null_;
call symput('ALLOBS', nobs);
stop;
set simple nobs=nobs;
run;
data _null_;
put "number of obs are &ALLOBS.";
stop;
run;
• Prints
number of obs are 1
NOBS – the catch: where
• Processing is at the file level – before the where clause:
data _null_;
put nobs=;
stop;
set simple nobs=nobs;
run;
• And
data _null_;
put nobs=;
stop;
set simple nobs=nobs;
where a = 10;
run;
• Both print the same result:
NOBS=1
NOBS – the catch: where
• I found out the hard way
• I had a process that rsubmitted N jobs to process the objects within
an XML file
• Each of the N jobs processed 1/Nth of the objects to spread load
• Process worked fine until the user said "Don't bother with THESE
tables".
• I figured "Oh, this is SAS, this is an easy change: 'where TABLE
not in (THESE1, THESE2, ... THESEn)'".
• The process worked fine but runtimes went up – no longer were N
processes running; the last 2 never started up.
• Solution was to add another data step in front to execute the
'where'
• Input to the rsubmit process now had the correct nobs
NOBS – the catch: not a new
variable
• Your nobs variable is special – it will not appear in the output
dataset
data new;
set simple nobs=nobs;
run;
proc print data=new; run;
• Prints
Obs a
1 42
• Coding the nobs variable in a keep statement is not a fix:
data new (keep=a nobs);
WARNING: The variable nobs in the DROP, KEEP, or RENAME
list has never been referenced.
• Only solution is an equal sign (even retain does not help):
nnobs=nobs;
NOBS – the catch: options obs=
• Is independent of options obs=;
options obs=2;
data _null_;
put nobs=;
stop;
set large nobs=nobs;
run;
• And (obs=)
data _null_;
put nobs=;
stop;
set large(obs=2) nobs=nobs;
run;
• Both print
nobs=915803
NOBS – the catch: not every engine
• The XML Engine does not properly implement:
filename SXLEMAP "OUR_MAP_FILE.map";
filename test2 "OUR_INPUT_FILE.xml";
libname test2 xml xmlmap=SXLEMAP access=READONLY;
NOTE: Libref TEST2 was successfully assigned as follows:
Engine: XML
Physical Name: TEST2
data _null_;
put nobs=;
stop;
set test2.application nobs=nobs;
run;
• Printing
nobs=9.0071993E15
• When the file only contained 17,383,357 bytes
Wrap Up
Questions
and
Answers
?!
?!
?!
?!
?
?
?
?
! !
! !
Presenter
David B. Horvath, CCP, MS
Copyright © 2015-2021 David B. Horvath, CCP — All Rights Reserved
The Author can be contacted at:
504 Longbotham Drive, Aston PA 19014-2502, USA
Phone: 1-610-859-8826
Email: dhorvath@cobs.com
Web: http://www.cobs.com/
LinkedIn: https://www.linkedin.com/in/dbhorvath/
All trademarks and servicemarks are the
property of their respective owners.

More Related Content

Similar to 202110 SESUG 46 NOBS for Noobs

DIG1108C Lesson3 Fall 2014
DIG1108C Lesson3 Fall 2014DIG1108C Lesson3 Fall 2014
DIG1108C Lesson3 Fall 2014
David Wolfpaw
 
Hadoop for the Absolute Beginner
Hadoop for the Absolute BeginnerHadoop for the Absolute Beginner
Hadoop for the Absolute Beginner
Ike Ellis
 
Dapper: the microORM that will change your life
Dapper: the microORM that will change your lifeDapper: the microORM that will change your life
Dapper: the microORM that will change your life
Davide Mauri
 
202110 SESUG 43 To Compress or not
202110 SESUG 43 To Compress or not202110 SESUG 43 To Compress or not
202110 SESUG 43 To Compress or not
dhorvath
 
Big data Hadoop Analytic and Data warehouse comparison guide
Big data Hadoop Analytic and Data warehouse comparison guideBig data Hadoop Analytic and Data warehouse comparison guide
Big data Hadoop Analytic and Data warehouse comparison guide
Danairat Thanabodithammachari
 
Pass chapter meeting dec 2013 - compression a hidden gem for io heavy databas...
Pass chapter meeting dec 2013 - compression a hidden gem for io heavy databas...Pass chapter meeting dec 2013 - compression a hidden gem for io heavy databas...
Pass chapter meeting dec 2013 - compression a hidden gem for io heavy databas...
Charley Hanania
 
The 5 Minute MySQL DBA
The 5 Minute MySQL DBAThe 5 Minute MySQL DBA
The 5 Minute MySQL DBA
Irawan Soetomo
 
Bigdata ready reference
Bigdata ready referenceBigdata ready reference
Bigdata ready reference
Helly Patel
 
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
Dave Stokes
 
DATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backupDATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backup
Saewoong Lee
 
NoSQL Solutions - a comparative study
NoSQL Solutions - a comparative studyNoSQL Solutions - a comparative study
NoSQL Solutions - a comparative study
Guillaume Lefranc
 
Neo4j Training Cypher
Neo4j Training CypherNeo4j Training Cypher
Neo4j Training Cypher
Max De Marzi
 
HADOOP DISTRIBUTED FILE SYSTEM AND MAPREDUCE
HADOOP DISTRIBUTED FILE SYSTEM AND MAPREDUCEHADOOP DISTRIBUTED FILE SYSTEM AND MAPREDUCE
HADOOP DISTRIBUTED FILE SYSTEM AND MAPREDUCE
Harsha Siva Sai
 
Ceph Internals
Ceph InternalsCeph Internals
Ceph Internals
Victor Santos
 
Data science and Hadoop
Data science and HadoopData science and Hadoop
Data science and Hadoop
Donald Miner
 
Dbops, DevOps & Ops, by Eduardo Piairo
Dbops, DevOps & Ops, by Eduardo PiairoDbops, DevOps & Ops, by Eduardo Piairo
Dbops, DevOps & Ops, by Eduardo Piairo
Agile Connect®
 
Big SQL 3.0: Datawarehouse-grade Performance on Hadoop - At last!
Big SQL 3.0: Datawarehouse-grade Performance on Hadoop - At last!Big SQL 3.0: Datawarehouse-grade Performance on Hadoop - At last!
Big SQL 3.0: Datawarehouse-grade Performance on Hadoop - At last!
Nicolas Morales
 
Hadoop – big deal
Hadoop – big dealHadoop – big deal
Hadoop – big deal
Abhishek Kumar
 
Make Life Suck Less (Building Scalable Systems)
Make Life Suck Less (Building Scalable Systems)Make Life Suck Less (Building Scalable Systems)
Make Life Suck Less (Building Scalable Systems)
guest0f8e278
 
myHadoop 0.30
myHadoop 0.30myHadoop 0.30
myHadoop 0.30
Glenn K. Lockwood
 

Similar to 202110 SESUG 46 NOBS for Noobs (20)

DIG1108C Lesson3 Fall 2014
DIG1108C Lesson3 Fall 2014DIG1108C Lesson3 Fall 2014
DIG1108C Lesson3 Fall 2014
 
Hadoop for the Absolute Beginner
Hadoop for the Absolute BeginnerHadoop for the Absolute Beginner
Hadoop for the Absolute Beginner
 
Dapper: the microORM that will change your life
Dapper: the microORM that will change your lifeDapper: the microORM that will change your life
Dapper: the microORM that will change your life
 
202110 SESUG 43 To Compress or not
202110 SESUG 43 To Compress or not202110 SESUG 43 To Compress or not
202110 SESUG 43 To Compress or not
 
Big data Hadoop Analytic and Data warehouse comparison guide
Big data Hadoop Analytic and Data warehouse comparison guideBig data Hadoop Analytic and Data warehouse comparison guide
Big data Hadoop Analytic and Data warehouse comparison guide
 
Pass chapter meeting dec 2013 - compression a hidden gem for io heavy databas...
Pass chapter meeting dec 2013 - compression a hidden gem for io heavy databas...Pass chapter meeting dec 2013 - compression a hidden gem for io heavy databas...
Pass chapter meeting dec 2013 - compression a hidden gem for io heavy databas...
 
The 5 Minute MySQL DBA
The 5 Minute MySQL DBAThe 5 Minute MySQL DBA
The 5 Minute MySQL DBA
 
Bigdata ready reference
Bigdata ready referenceBigdata ready reference
Bigdata ready reference
 
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
 
DATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backupDATABASE AUTOMATION with Thousands of database, monitoring and backup
DATABASE AUTOMATION with Thousands of database, monitoring and backup
 
NoSQL Solutions - a comparative study
NoSQL Solutions - a comparative studyNoSQL Solutions - a comparative study
NoSQL Solutions - a comparative study
 
Neo4j Training Cypher
Neo4j Training CypherNeo4j Training Cypher
Neo4j Training Cypher
 
HADOOP DISTRIBUTED FILE SYSTEM AND MAPREDUCE
HADOOP DISTRIBUTED FILE SYSTEM AND MAPREDUCEHADOOP DISTRIBUTED FILE SYSTEM AND MAPREDUCE
HADOOP DISTRIBUTED FILE SYSTEM AND MAPREDUCE
 
Ceph Internals
Ceph InternalsCeph Internals
Ceph Internals
 
Data science and Hadoop
Data science and HadoopData science and Hadoop
Data science and Hadoop
 
Dbops, DevOps & Ops, by Eduardo Piairo
Dbops, DevOps & Ops, by Eduardo PiairoDbops, DevOps & Ops, by Eduardo Piairo
Dbops, DevOps & Ops, by Eduardo Piairo
 
Big SQL 3.0: Datawarehouse-grade Performance on Hadoop - At last!
Big SQL 3.0: Datawarehouse-grade Performance on Hadoop - At last!Big SQL 3.0: Datawarehouse-grade Performance on Hadoop - At last!
Big SQL 3.0: Datawarehouse-grade Performance on Hadoop - At last!
 
Hadoop – big deal
Hadoop – big dealHadoop – big deal
Hadoop – big deal
 
Make Life Suck Less (Building Scalable Systems)
Make Life Suck Less (Building Scalable Systems)Make Life Suck Less (Building Scalable Systems)
Make Life Suck Less (Building Scalable Systems)
 
myHadoop 0.30
myHadoop 0.30myHadoop 0.30
myHadoop 0.30
 

Recently uploaded

Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 

Recently uploaded (20)

Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 

202110 SESUG 46 NOBS for Noobs

  • 1. 46: NOBS for Noobs David B. Horvath, CCP, MS
  • 2. Presenter The Author can be contacted at: 504 Longbotham Drive, Aston PA 19014-2502, USA Phone: 1-610-859-8826 Email: dhorvath@cobs.com Web: http://www.cobs.com/ LinkedIn: https://www.linkedin.com/in/dbhorvath/ All trademarks and servicemarks are the property of their respective owners. David B. Horvath, CCP, MS Copyright © 2015-2021 David B. Horvath, CCP — All Rights Reserved
  • 3. Abstract This mini-session will be a short discussion of the NOBS (number of observations) option on the SET statement. This includes one "gotcha" that I've run into with where clauses: NOBS is set before WHERE processing. If you have a reason to know the number of observations after the WHERE clause, another DATA step is needed.
  • 4. My Background • David is an IT Professional who has worked with various platforms since the 1980’s with a variety of development and analysis tools. • He has presented at PhilaSUG, SESUG, and SGF previously and has presented workshops and seminars in Australia, France, the US, Canada, and Oxford England (about the British Author Nevil Shute). • He holds an undergraduate degree in Computer and Information Sciences from Temple University and a Masters in Organizational Dynamics from UPENN. He achieved the Certified Computing Professional designation with honors. • Most of his career has been in consulting (although recently he has been in-house) in the Philadelphia PA area. He is currently in Data Analytics "Engineering" at a Regional Bank. • He has several books to his credit (none SAS related) and is an Adjunct Instructor covering IT topics.
  • 5. Basic NOBS • The nobs statement is a handy way of discovering how many observations are in your SAS Dataset: data simple; a = 42; output; run; data _null_; put nobs=; stop; set simple nobs=nobs; run; • Prints NOBS=1
  • 6. Macro NOBS • Great information if you need it! • Is available before first row is processed • Can be stored in macro variable for global usage: data _null_; call symput('ALLOBS', nobs); stop; set simple nobs=nobs; run; data _null_; put "number of obs are &ALLOBS."; stop; run; • Prints number of obs are 1
  • 7. NOBS – the catch: where • Processing is at the file level – before the where clause: data _null_; put nobs=; stop; set simple nobs=nobs; run; • And data _null_; put nobs=; stop; set simple nobs=nobs; where a = 10; run; • Both print the same result: NOBS=1
  • 8. NOBS – the catch: where • I found out the hard way • I had a process that rsubmitted N jobs to process the objects within an XML file • Each of the N jobs processed 1/Nth of the objects to spread load • Process worked fine until the user said "Don't bother with THESE tables". • I figured "Oh, this is SAS, this is an easy change: 'where TABLE not in (THESE1, THESE2, ... THESEn)'". • The process worked fine but runtimes went up – no longer were N processes running; the last 2 never started up. • Solution was to add another data step in front to execute the 'where' • Input to the rsubmit process now had the correct nobs
  • 9. NOBS – the catch: not a new variable • Your nobs variable is special – it will not appear in the output dataset data new; set simple nobs=nobs; run; proc print data=new; run; • Prints Obs a 1 42 • Coding the nobs variable in a keep statement is not a fix: data new (keep=a nobs); WARNING: The variable nobs in the DROP, KEEP, or RENAME list has never been referenced. • Only solution is an equal sign (even retain does not help): nnobs=nobs;
  • 10. NOBS – the catch: options obs= • Is independent of options obs=; options obs=2; data _null_; put nobs=; stop; set large nobs=nobs; run; • And (obs=) data _null_; put nobs=; stop; set large(obs=2) nobs=nobs; run; • Both print nobs=915803
  • 11. NOBS – the catch: not every engine • The XML Engine does not properly implement: filename SXLEMAP "OUR_MAP_FILE.map"; filename test2 "OUR_INPUT_FILE.xml"; libname test2 xml xmlmap=SXLEMAP access=READONLY; NOTE: Libref TEST2 was successfully assigned as follows: Engine: XML Physical Name: TEST2 data _null_; put nobs=; stop; set test2.application nobs=nobs; run; • Printing nobs=9.0071993E15 • When the file only contained 17,383,357 bytes
  • 13. Presenter David B. Horvath, CCP, MS Copyright © 2015-2021 David B. Horvath, CCP — All Rights Reserved The Author can be contacted at: 504 Longbotham Drive, Aston PA 19014-2502, USA Phone: 1-610-859-8826 Email: dhorvath@cobs.com Web: http://www.cobs.com/ LinkedIn: https://www.linkedin.com/in/dbhorvath/ All trademarks and servicemarks are the property of their respective owners.