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

I have an excel .csv file that looks like this:

 

Type         Value

Time          1:00 pm

Level1       52.3

Level2      52.3

Level3       52.3

Level4       52.3

 

I import it into SAS (version 9.4) and use proc transpose and get data that looks like this:

Name of Former Variable        COL1     COL2     COL3     COL4      COL5

Type                                        Time       Level1    Level2    Level3     Level4

Value                                        52.3       52.3        52.3      52.3         52.3

 

My goal is to turn the second row into the actual variable name: COL1 = Time; COL2 = Level1, etc.

I'm so stumped. Does anyone have any sugestions on appropriate code?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Fix your proc transpose:

 

proc transpose data=have out=want;
var value;
id type;
run;

View solution in original post

3 REPLIES 3
Reeza
Super User

Did you use the ID option in proc transpose? 

Can you post your code?

dubya
Calcite | Level 5

The only code I've used is

proc import datafile="C:levels.csv"
     out=ndb103232015
     dbms=csv
     replace;
     getnames=yes;
run;

proc transpose data=ndb103232015 out=ndb103232015_transpose; var type value; run;
Reeza
Super User

Fix your proc transpose:

 

proc transpose data=have out=want;
var value;
id type;
run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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