Simple enough with an array. But the input variable name should not be one of the target variable names, that just complicates things.
data have;
input X;
datalines;
71
122
167
122
194
166
167
266
365
;
So read 3 observations at a time and insert them into the proper variable using an index into an array.
data want;
array p p1-p3;
do column=1 to 3 until(eof);
set have end=eof;
p[column]=x;
end;
drop column x;
run;
If you are actually reading the data from a text file then just read it originally directly into the array.
data want;
input p1-p3;
datalines;
71
122
167
122
194
166
167
266
365
;
... View more