How can I change the dataset
like this
x1 y1 5
x2 y1 2
x1 y2 4
x2 y2 3
into this
y1 y2
x1 5 4
x2 2 3
It will be graceful if someone can help me out!
proc sort data=have;
by x;
run;
proc transpose data=have out=want;
by x;
id y;
var column3;
run;
Since you didn't provide variable names, I chose my own variable names. I hope you can figure out which name corresponds to which variable.
In the future, please provide variable names.
In the future, please provide (a portion of) your data as a SAS data step, as explained here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...
proc sort data=have;
by x;
run;
proc transpose data=have out=want;
by x;
id y;
var column3;
run;
Since you didn't provide variable names, I chose my own variable names. I hope you can figure out which name corresponds to which variable.
In the future, please provide variable names.
In the future, please provide (a portion of) your data as a SAS data step, as explained here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch Now →SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.