colon modifier (:) in array value and underscore(_in) in array variable name
colon modifier (:) in array value and underscore(_in) in array variable name
(OP)
I am trying to understand the folowing piece of code:
data long (keep=icd9 icd10);
set cwalk_wide;
array _in(*) $ icd10:;
i=1;
do while (i le dim(_in));
if not missing(_in{i}) then do;
icd10=_in(i);
output;
i+1;
end;
else i=dim(_in)+1;
end;
run;
Could you please help me to understand what the above code does (particularly colon(:) and _in?
data long (keep=icd9 icd10);
set cwalk_wide;
array _in(*) $ icd10:;
i=1;
do while (i le dim(_in));
if not missing(_in{i}) then do;
icd10=_in(i);
output;
i+1;
end;
else i=dim(_in)+1;
end;
run;
Could you please help me to understand what the above code does (particularly colon(:) and _in?
RE: colon modifier (:) in array value and underscore(_in) in array variable name
Ex.
CODE
Ex.
CODE
You can also have an array automatically grab all vars of the same type.
Ex.
CODE
If we were to loop through the above array how would we know when to stop the loop? So we use the DIM() function.
ex.
CODE
I hope that this helps.
Klaz