From: jo on
Hi,

I've been trying to add a new variable to an existing data set using
proc IML, but I always recieve the following error: ERROR: <Variable>
is not in the scope of variables for the data set.

This is the code I've been using, and the error comes after the
"append" command.

proc iml;
use mydata;
read all var {conm} into y;
n=nrow(y);
id=J(n,1,0);
f=1;
id[1,1]=1;
DO i=2 to n-1;
If y[i,1]=y[i-1,1] then id[i,1]=f;
else if y[i,1]^=y[i-1,1] then DO;
id[i,1]=f+1;
f=f+1;
end;
end;
edit mydata;
append var{id};
run;
quit;