BookmarkSubscribeRSS Feed
Pinkboss
Calcite | Level 5

Hello ang good day everyone,

 

I am very new to EG.

 

I have several SAS data sets that I would like to adjust. For some I would like to take the row headers and put them into column headers, and others I would like to put the column headers and move them into row headers.

 

Can you please help with this?

 

Also, any good books I can get to help me with working through examples?

 

 

Thanks for your feedback.

4 REPLIES 4
ballardw
Super User

It helps to provide example data, not as Excel, many of us don't want to open such files from unknown sources. Show what you have and what you want.

SAS has a procedure named transpose that has the purpose of reshaping data as you request but the devil is in the details.

For instance are your "row labels", such is not a concept for SAS data sets, text or numeric? Since the variables (columns) are restricted in naming your desired values may not work because variable names must start with _ or letter (not numerals) and the other characters may only be letters, digits or the _ character with a limit of 32 characters. HOWEVER SAS has the concept of a variable label with can be quite longer and is used to provide nice displays in most procedures or output.

 

I recommend starting with the SAS online help if installed. There is a section title 'Learning to Use SAS' which has example programs and data.

There is also some free on line classes available at: https://support.sas.com/edu/elearning.html?ctry=us&productType=library

 

Reeza
Super User
https://stats.idre.ucla.edu/sas/modules/

The bottom of the page has specific links on transforming your data - ie long to wide and wide to long

Classic Data Management Problems
Merging Data Files via Data Step, Proc SQL
Concatenating (stacking) SAS data files
Working across variables
Collapsing across observations in SAS via Proc Means, Proc SQL , Data Step I , Data Step II
Reshaping data from wide to long via Proc Transpose , Data Step
Reshaping data from long to wide via Proc Transpose , Data Step
Pinkboss
Calcite | Level 5

Hello everyone,

 

Here is the data that I'm looking at as an example. I have placed it as a attachment.

 

Thank you for the quick response.

 

 


SAS Photo.JPG
Reeza
Super User

You showed us a data set. That's great. Now what are you trying to do with it? 

 

Note that if you ever want code as a solution and you post an image, how would you expect us to work with the image. Based on what you've provided, the answer stands as it is. Please see the links in my previous post.

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
  • 4 replies
  • 2326 views
  • 0 likes
  • 3 in conversation