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

 

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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