Hi all,
Using the SAS code below, I can ask SAS to output the correct value from the column COL{i} when it meets the condition i specified in my code. However, i'm wondering how can I also ask SAS to tell me which COL{i} the value is coming from.
In order word, prior_date is getting the values from the COL{i} column, I want to find a way to ask SAS also tell me which column the COL{i} is. Do you know how I can do it?
data ae_temp1;
set ae_temp1;
array col{*} col1 - col12;
do i = 1 to 11;
if length(aestdtc) = 10 then
do;
if col{i+1} ^= '' then
do;
if input(scan(col{i}, 1, 'T'), yymmdd10.) <= input(aestdtc, yymmdd10.) and input(scan(col{i+1}, 1, 'T'), yymmdd10.) > input(aestdtc, yymmdd10.) then
Prior_date = col{i};
end;
if col{i}^= '' and col{i+1} = '' then
do;
if input(scan(col{i}, 1, 'T'), yymmdd10.) <= input(aestdtc, yymmdd10.) then
prior_date = col{i};
end;
end;
end;
run;