« Useful shortcut commands in SAS 9.x | Main | Where statements in the DATA step »

January 04, 2013

_n_ variable in SAS

Creating a post on this because the interwebs appear to be a bit crossed.

One source indicates

The automatic variable _n_ represents the observation numbers.

While another indicates

Each time the DATA step loops past the DATA statement, the variable _N_ increments by 1. The value of _N_ represents the number of times the DATA step has iterated.

I suppose these are equivalent statements if the data step iterates for every observation in the data file.

Posted by kkwaiser at January 4, 2013 04:09 PM


Login to leave a comment. Create a new account.