<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic proc transpose in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-transpose/m-p/579342#M164446</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;am tring to transpose a dataset:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
infile datalines;
input class $ type $ year sex stage
datalines;
a12  event1 0  2  100
a12  event2 0  2  100
a12  event3 0  2  100
a12  event4 0  2  100
a12  unkn    0  2  100
a12  event1 1  2  95
a12  event2 1  2  92
a12  event3 1  2  48
a12  event4 1  2  91
a12  unkn    1  2  100
a12  event1 2  2  94
a12  event2 2  2  80
a12  event3 2  2  55
a12  event4 2  2  23
a12  unkn    2  2  50
a12  event1 3  2  77
a12  event2 3  2  69
a12  event3 3  2  80
a12  event4 3  2  90
a12  unkn   3  2  88
a12  event1 4  2  99
a12  event2 4  2  36
a12  event3 4  2  57
a12  event4 4  2  94
a12  unkn    4  2  60
a12  event1 5  2  69
a12  event2 5  2  47
a12  event3 5  2  52
a12  event4 5  2  76
a12  unkn    5  2  98
;&lt;BR /&gt;run;


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;at the end I wish to get an output that looks like this: (the attached excel data)&lt;/P&gt;&lt;P&gt;I tried using this code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=test out=test_trans;
id type;
var stage;
by type;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;this was giving a warning that the "id value is twice by the same group" so I added "let" at the end of&amp;nbsp; proc transpose.&lt;/P&gt;&lt;P&gt;This is not giving me the desired output. It only gives me the last values of each type.&lt;/P&gt;&lt;P&gt;please any help?&lt;/P&gt;</description>
    <pubDate>Tue, 06 Aug 2019 12:37:52 GMT</pubDate>
    <dc:creator>Anita_n</dc:creator>
    <dc:date>2019-08-06T12:37:52Z</dc:date>
    <item>
      <title>proc transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-transpose/m-p/579342#M164446</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;am tring to transpose a dataset:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
infile datalines;
input class $ type $ year sex stage
datalines;
a12  event1 0  2  100
a12  event2 0  2  100
a12  event3 0  2  100
a12  event4 0  2  100
a12  unkn    0  2  100
a12  event1 1  2  95
a12  event2 1  2  92
a12  event3 1  2  48
a12  event4 1  2  91
a12  unkn    1  2  100
a12  event1 2  2  94
a12  event2 2  2  80
a12  event3 2  2  55
a12  event4 2  2  23
a12  unkn    2  2  50
a12  event1 3  2  77
a12  event2 3  2  69
a12  event3 3  2  80
a12  event4 3  2  90
a12  unkn   3  2  88
a12  event1 4  2  99
a12  event2 4  2  36
a12  event3 4  2  57
a12  event4 4  2  94
a12  unkn    4  2  60
a12  event1 5  2  69
a12  event2 5  2  47
a12  event3 5  2  52
a12  event4 5  2  76
a12  unkn    5  2  98
;&lt;BR /&gt;run;


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;at the end I wish to get an output that looks like this: (the attached excel data)&lt;/P&gt;&lt;P&gt;I tried using this code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=test out=test_trans;
id type;
var stage;
by type;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;this was giving a warning that the "id value is twice by the same group" so I added "let" at the end of&amp;nbsp; proc transpose.&lt;/P&gt;&lt;P&gt;This is not giving me the desired output. It only gives me the last values of each type.&lt;/P&gt;&lt;P&gt;please any help?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2019 12:37:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-transpose/m-p/579342#M164446</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2019-08-06T12:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: proc transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-transpose/m-p/579345#M164448</link>
      <description>&lt;P&gt;You use the wrong "by" variable, see this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=test out=test_trans (drop=_name_);
id type;
var stage;
by year;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Aug 2019 12:42:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-transpose/m-p/579345#M164448</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-08-06T12:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: proc transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-transpose/m-p/579347#M164450</link>
      <description>&lt;P&gt;Thanks a lot it worked fine&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2019 12:45:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-transpose/m-p/579347#M164450</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2019-08-06T12:45:05Z</dc:date>
    </item>
  </channel>
</rss>

