BookmarkSubscribeRSS Feed
Fred_Gavin
Calcite | Level 5
I got a set of data which looks like
Date company1 _price Date1 company2_price
1 23 1 10
2 12 2 11
3 11 3 15
4 15 4 16
5 17 5 17
6 18 6 18

I wanna transfer it to the form of

Date Company Price(as above)
1 company1 23
2 1 12
3 1 11
4 1
5 1
6 1
1 2
2 2
3 2
4 2
5 2
6 2

It would be really appreciated if someone could help out.
Thanks..
3 REPLIES 3
DanielSantos
Barite | Level 11
Very confusing to me...

Could you please detail the transformation?!

Greetings from Portugal.

Daniel Santos at www.cgd.pt
Fred_Gavin
Calcite | Level 5
Hi Daniel,
Thanks for your reply.

In the original data, the each company consists of two columns, the first colum is date and second one is its share price. So for example, if there are three companies, the original looks like

Date Company1_Price Date Company2_Price Date Company3_Price
1 $12 1 $15 1
2 2 2
3 3 3
(for each company, dates are the same)

Now i want to transfer it to the following form

Date Firm Price
1 company1
2 company1
3 company1
1 company2
2 company2
3 company2
1 company3
2 company3
3 company3
LinusH
Tourmaline | Level 20
You just need some basic data step programming, using assignment and OUTPUT statements. Not having looked into it in detail, I guess that PROC TRANSPOSE could be an option too.

/Linus
Data never sleeps

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
  • 686 views
  • 0 likes
  • 3 in conversation