For a report? Or in a data set? This seem smore like a report structure than data set structure.
*assumes data is sorted correctly. If order is important as in the file structure, add the word NOTSORTED to the end of the BY statement;
*replace data set and variable names as needed;
data want;
set have;
by Col2 Col1;
if first.Col2 then do;
temp=col1;
col1=col2;
output;
col1=temp;
output;
end;
else output;
keep col1;
run;
The 2025 SAS Hackathon has begun!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.