BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
acemanhattan
Quartz | Level 8

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.

 

SAS_PIC.png

1 ACCEPTED SOLUTION

Accepted Solutions
RahulG
Barite | Level 11

 

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. 

View solution in original post

2 REPLIES 2
RahulG
Barite | Level 11

 

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. 

Reeza
Super User

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. 

https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...

 

At aminimum paste it in as text rather than an image. 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 883 views
  • 2 likes
  • 3 in conversation