Help using Base SAS procedures

Data Manipulation

Reply
Contributor
Posts: 56

Data Manipulation

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..
Super Contributor
Posts: 474

Re: Data Manipulation

Very confusing to me...

Could you please detail the transformation?!

Greetings from Portugal.

Daniel Santos at www.cgd.pt
Contributor
Posts: 56

Re: Data Manipulation

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
Super User
Posts: 5,256

Re: Data Manipulation

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
Ask a Question
Discussion stats
  • 3 replies
  • 109 views
  • 0 likes
  • 3 in conversation