Hello,
The problem I have is the following: In my program, I want to create a new variable when a current variable has a missing value. This is what I already have:
data basetabel_imputed;
set basetablenum;
array wit{*} _numeric_;
do i=1 to dim(wit);
if wit(i)=. then do;
wit(i)= symget(vname(wit(i));
end;
end;
drop i;
run;
I read in the variables, make an array of the numeric ones and then, for every numeric variable, I change the missing value by the median of that variable. Now, in the second do loop, I want to create a new variable, that has the same name as the variable currently accessed by the do loop, except that I want to add the suffix mv to it. Then I want this new variable to take the value 1. What I want is in fact a statement that does:
vname(wit(i))||mv = 1;
(but his doensn't work because one cannot create a new variable name like that).
Matthijs
The problem I have is the following: In my program, I want to create a new variable when a current variable has a missing value. This is what I already have:
data basetabel_imputed;
set basetablenum;
array wit{*} _numeric_;
do i=1 to dim(wit);
if wit(i)=. then do;
wit(i)= symget(vname(wit(i));
end;
end;
drop i;
run;
I read in the variables, make an array of the numeric ones and then, for every numeric variable, I change the missing value by the median of that variable. Now, in the second do loop, I want to create a new variable, that has the same name as the variable currently accessed by the do loop, except that I want to add the suffix mv to it. Then I want this new variable to take the value 1. What I want is in fact a statement that does:
vname(wit(i))||mv = 1;
(but his doensn't work because one cannot create a new variable name like that).
Matthijs