I apologize in advance, because I doubt that this screenshot is the most helpful format, but I don't know how to post a table.
What I'd like to do is go from the dataset on the left to the one on the right, but, as I'm just beyond a beginner in SAS, I don't have any idea how to do it. Any feedback would be appreciated, including feedback about how to post the data from this screenshot in a more user friendly fashion. Thanks.
data emp_sal;
input Empid $ year salary;
datalines;
Emp1 1996 2596
Emp1 1997 2600
Emp2 1997 8596
Emp2 1998 8700
Emp3 1997 6200
Emp3 1998 6500
Emp3 1999 6800
;
proc transpose data=emp_sal out=transpose_emp_sal;
by Empid;
ID year;
run;
I have given the most simple proc transpose without using much option.
Read about proc transpose and exlore.
Regarding posting question, Any way that can be understood, it is nice that you have shown what is your input dataset and what do you wnat as output.
data emp_sal;
input Empid $ year salary;
datalines;
Emp1 1996 2596
Emp1 1997 2600
Emp2 1997 8596
Emp2 1998 8700
Emp3 1997 6200
Emp3 1998 6500
Emp3 1999 6800
;
proc transpose data=emp_sal out=transpose_emp_sal;
by Empid;
ID year;
run;
I have given the most simple proc transpose without using much option.
Read about proc transpose and exlore.
Regarding posting question, Any way that can be understood, it is nice that you have shown what is your input dataset and what do you wnat as output.
Look into Transpose, in EG I believe it's a task.
If your coding it's proc transpose.
If you want to get better answers including code, it helps to post data as a data step.
At aminimum paste it in as text rather than an image.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.