[Solved] How to select specific value in sas


This answers your first question, but I have a feeling its not what you’re actually after.
I’ve also added in a second dataset have2, perhaps you can better explain what you’re after if the data is in that structure.

data have;
input value1 $    value2 $  value3 $;
cards;
X1       X2       X3
Y1       Y2       Y3
Z1       Z2       Z3
;
run;

data want;
set have;
array va(3) value1-value3;

if _n_=1 then va(_n_)=va(_n_+1);

keep value1;
run;


data have2;
    set have;
    array va(3) value1-value3;

    do i=1 to 3;
        value=va(i);
        row=_n_;
        output;
    end;
    keep value row;
run;

2

solved How to select specific value in sas