DATA Step, Macro, Functions and more

transpose row values

Accepted Solution Solved
Reply
Contributor
Posts: 68
Accepted Solution

transpose row values

Hello Expert, 

 

I have source data like below and looking for below output, could you Please help me on it.

 

 

trans.JPG


Accepted Solutions
Solution
‎08-03-2017 05:55 AM
Trusted Advisor
Posts: 1,586

Re: transpose row values

Posted in reply to Ritesh_dellvostro

You can use next code:

data want;
  set have;
      array k {india usa uk aus};
      array d $ {india_desc usa_title uk_mem aus_coun};
      do i=1 to 4;
          key = k(i);
          desc = d(i);
          output;
      end;
     keep bkey key desc;
run;

View solution in original post


All Replies
Solution
‎08-03-2017 05:55 AM
Trusted Advisor
Posts: 1,586

Re: transpose row values

Posted in reply to Ritesh_dellvostro

You can use next code:

data want;
  set have;
      array k {india usa uk aus};
      array d $ {india_desc usa_title uk_mem aus_coun};
      do i=1 to 4;
          key = k(i);
          desc = d(i);
          output;
      end;
     keep bkey key desc;
run;
☑ This topic is solved.

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

Discussion stats
  • 1 reply
  • 87 views
  • 0 likes
  • 2 in conversation