SAS Missing Data Imputation: Arrays + Proc STDIZE

#1
Hi Guys

I came across this following code:

data dataset(drop=i);
set data;

array mi{*} mi_Ag mi_Inc
mi_WR;

array x{*} Ag Inc WR;
do i=1 to dim(mi);
mi{i}=(x{i}=.);
end;
run;

I need to understand two things:

1.) there is a column created titles "i" once this data step is run. What does that signify and why is there. The drop "i" essentially drops it but if i don't use drop option the column stays in the data set

2.) this do step is replacing all the missing values with a 1 and rest with 0. How is that happening when nothing is clearly specified in the do step as to what needs to be done. In my eyes, "do i=1 to dim(mi); mi{i}=(x{i}=.);" should simply put dots in mi(i) wherever it finds dots in x(i).

All helps is much appreciated.
 

hlsmith

Less is more. Stay pure. Stay poor.
#2
Where did you get the code from, can you cite the source? Where is the Proc stdize?

In the array 'i' is used as a placeholder, once the change is made you no longer need the new variable so you drop it.
 
#3
hi hlsmith, this code I came across going through an online SAS resource (one of their modeling courses that you have to pay for). Proc STDIZE is run after this code is run and that is actually pretty self-explanatory as it uses the dataset created in this earlier step as the input.