BookmarkSubscribeRSS Feed
priyankachauhan
Calcite | Level 5

inobs and outobs showing the same no. of rows in the table. so what is the difference between them?

3 REPLIES 3
Shmuel
Garnet | Level 18

in some cases you may want to split observations - e.g write out per date in a range of dates.

in other case you may want to filter your input and select output according to some rules.

in both cases inobs will differ from outobs.

novinosrin
Tourmaline | Level 20

Hi @priyankachauhan@Shmuel is very kind enough to explain how it works. I am sure, you may or may not understand a lot of concepts if you are a beginner. I found it very hard when i was a beginner 5 years ago. I suggest you to get a copy of this amazing book which has everything that you want and more-

 

PROC SQL: Beyond the Basics Using SAS®, Second Edition
PROC SQL: Beyond the Basics Using SAS®, Second Edition
In Stock
Publisher: SAS Institute
Reeza
Super User

In the simplest cases they are the same. But as soon as you complicate things they are not. 

 

They do what it sounds like it does, one controls how many records are read, InOBS) and one controls how many records are output. Since the number of records read obviously affects the outcome they are very different. 
Here's an example of the exact same code and INOBS=2 and OUTOBS=2 in each run. Check the output.

 

title 'OutObs demo';
proc sql outobs=2;
select age, count(*)
from sashelp.class
group by age
order by age desc;
;
quit;


title 'InObs demo';
proc sql inobs=5;
select age, count(*)
from sashelp.class
group by age
order by age desc;
;
quit;

Results:

 

Screen Shot 2017-12-10 at 12.02.47 PM.png

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 3 replies
  • 26471 views
  • 4 likes
  • 4 in conversation