Calculate a SAS Observation Length

Well, I couldn't find this documented anywhere (someone correct me if I missed it) but the question for the day was how to calculate the SAS Observation Length. After some investigation, here is how it is done (pseudocode):

obsLength = Sum of all of your character lengths + Sum of all of your variable lengths;

if any numeric variables have a length of 8 then
round the obsLength to the nearest factor of 8.

Since the default for numeric variables is a length of 8, the rounding will almost always occur but it is not a guarantee.

I hope this helps others who may need to calculate this value for storage or performance reasons.

Comments

Popular posts from this blog

DNN Error

SAS Deployment Manager and Meadow Muffins

SAS XPT Files, IBM Floats, and C#