Manipulating a dataset

Accepted Solution Solved
Reply
Contributor
Posts: 40
Accepted Solution

Manipulating a dataset

Hi

I have a dataset that looks like this :

PersonId     Name     PhoneNumber

2                john          111   

2                john          222

3               mike          333

3               mike          444

3               mike          555

4               sue            666

4               sue            777

4               sue            888

4               sue            999

it needs to look like this :

PersonId     Name     PhoneNumber1     PhoneNumber2     PhoneNumber3     PhoneNumber4

2               john          111                         222                         -                         -

3               mike          333                         444                         555

4               sue           666                          777                         888                    999

Any ideas ?


Accepted Solutions
Solution
‎01-15-2015 05:09 PM
Super User
Posts: 11,134

Re: Manipulating a dataset

proc transpose data=have out=want (drop=_name_) prefix=PhoneNumber;

by personid name;

var phonenumber;

run;

View solution in original post


All Replies
Solution
‎01-15-2015 05:09 PM
Super User
Posts: 11,134

Re: Manipulating a dataset

proc transpose data=have out=want (drop=_name_) prefix=PhoneNumber;

by personid name;

var phonenumber;

run;

Contributor
Posts: 40

Re: Manipulating a dataset

Thanks - much appreciated !

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 156 views
  • 0 likes
  • 2 in conversation