<?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 Re: proc transpose data from long back to wide in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-transpose-data-from-long-back-to-wide/m-p/694659#M211860</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;I tried as you suggested. In the "want" result data, the order of the itemID is not as I desired. The itemID should be in ascending order in the resulted "want" data. How should I modify your code?&lt;/P&gt;</description>
    <pubDate>Tue, 27 Oct 2020 18:52:49 GMT</pubDate>
    <dc:creator>superbug</dc:creator>
    <dc:date>2020-10-27T18:52:49Z</dc:date>
    <item>
      <title>proc transpose data from long back to wide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-transpose-data-from-long-back-to-wide/m-p/694648#M211855</link>
      <description>&lt;P&gt;My data has 1,201,250 rows, part of the data is as below.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;In each form, each examinee take the same 250 item.&amp;nbsp; There are a few same itemID across different forms. e.g. item pp012 in both AAA and BBB, pp012 and pp024 in both BBB and CCC.&amp;nbsp; there are 1350 unique items across all forms. I want to transpose this data back to wide to make a SPARSE matrix in terms of raw. The desired SPARSE matrix should have 1350 columns in terms of raw score. Any help would be much appreciated.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA have ; 
  INPUT form examineeID _NAME_   itemID  raw; 
CARDS ; 
AAA 111 raw_1  pp012   0 
AAA 111 raw_2  pp014   1
AAA 111 raw_3  pp017   1 
AAA 111 raw_4  pp015   0 
..
AAA 444 raw_1  pp012   1 
AAA 444 raw_2  pp014   0 
AAA 444 raw_3  pp017   1 
AAA 444 raw_4  pp015   1
...
BBB 777  raw_1 pp012   0
BBB 777  raw_2 pp024   1
BBB 777  raw_3 pp027   0
BBB 777  raw_4 pp025   1
...
BBB 999  raw_1 pp012   1
BBB 999  raw_2 pp024   1
BBB 999  raw_3 pp027   0
BBB 999  raw_4 pp025   0
....
CCC 666  raw_1 pp012   0
CCC 666  raw_2 pp024   1
CCC 666  raw_3 pp037   0
CCC 666  raw_4 pp035   1
...
CCC 888  raw_1 pp012   1
CCC 888  raw_2 pp024   1
CCC 888  raw_3 pp037   0
CCC 888  raw_4 pp035   0
...

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 18:21:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-transpose-data-from-long-back-to-wide/m-p/694648#M211855</guid>
      <dc:creator>superbug</dc:creator>
      <dc:date>2020-10-27T18:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: proc transpose data from long back to wide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-transpose-data-from-long-back-to-wide/m-p/694655#M211857</link>
      <description>&lt;P&gt;As long as the total length of FORM and ITEM is never more than 32 characters it should be simple.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=have  out=want(drop=_name_)  delim=_;
  by examineeID ;
  id form itemID;
  var raw ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Not sure what the extra variable _NAME_ is for in your source data.&amp;nbsp; The output of PROC TRANSPOSE will create a variable called _NAME_ to hold the name of the analysis variable (RAW in this case).&amp;nbsp; That is not useful so I asked it to be dropped.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 18:35:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-transpose-data-from-long-back-to-wide/m-p/694655#M211857</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-10-27T18:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: proc transpose data from long back to wide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-transpose-data-from-long-back-to-wide/m-p/694659#M211860</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;I tried as you suggested. In the "want" result data, the order of the itemID is not as I desired. The itemID should be in ascending order in the resulted "want" data. How should I modify your code?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 18:52:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-transpose-data-from-long-back-to-wide/m-p/694659#M211860</guid>
      <dc:creator>superbug</dc:creator>
      <dc:date>2020-10-27T18:52:49Z</dc:date>
    </item>
  </channel>
</rss>

