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

Hi,

 

suppose that I have the following table:

 

date  stock price
21-Jan-10 A 1
22-Jan-10 A 3
21-Jan-10 B 10
22-Jan-10 B 15

 

when I do the following code:

 

proc sort data=have;
by date;
run;
proc transpose data=have out=want ;
by date;
run;

I ge the result:

date _NAME_ _LABEL_ COL1 COL2
21/01/2010 price price 1 10
22/01/2010 price price 3 15

 

But the names of the stocks (A and B) appear as COL1 and COL2 - is it possible to have the real names of the stocks?

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Try adding to your current PROC TRANSPOSE:

 

id stock;

 

That's probably exactly what you are asking for.

View solution in original post

1 REPLY 1
Astounding
PROC Star

Try adding to your current PROC TRANSPOSE:

 

id stock;

 

That's probably exactly what you are asking for.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 661 views
  • 0 likes
  • 2 in conversation