_N_ gives the record number. You can access any record in
the dataset using _N_ if you know the record number. It is
set as 1 for the first record and incremented for every
subsequent record. It is an automatic variable and is not
visible when you open a dataset. This can also be used to
subset a data. For ex, if you want to access the first 100
records then you can say "if _N_ <= 100".
This is an automatic variable of PDV that returns the no of
observations that it has iterated.There are such variables
All these variables will not be displayed in the target output.
if _n_>=2 and <=6 then output;
Compiling time of the program in PDV automatically some
variables will generate, like _N_ and _Error_, _numeric_
_N_ will give the observation in the program. by default
_N_ value is 0, after compiling it will chage according to
the observations in the program.
Suppose there is a SAS dataset with following values -
and so on…..
This goes onto 1000s of observations/rows.
Now how do we identify from this dataset Grandparents and