<?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: can i transpose in existing datastep rather then using proc transpose in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378712#M91077</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/62004"&gt;@vraj1&lt;/a&gt;&amp;nbsp;There is no test data attached?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/62004"&gt;@vraj1&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Reason being i have usubjid duplicates and i need all of them and it gets omited in proc transpose. attached is test data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 24 Jul 2017 14:57:28 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-07-24T14:57:28Z</dc:date>
    <item>
      <title>can i transpose in existing datastep rather then using proc transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378668#M91060</link>
      <description>&lt;P&gt;proc transpose data=adds out=trans_adds let;&lt;BR /&gt; by usubjid ;&lt;BR /&gt; id param;&lt;BR /&gt; var avalc;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i am using the above step but can i make this possible so that i can transpose in data step?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 12:55:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378668#M91060</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2017-07-24T12:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: can i transpose in existing datastep rather then using proc transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378670#M91062</link>
      <description>&lt;P&gt;Yes, you can do that in a datastep. &amp;nbsp;Why would you want to do that however, when there is a procedure specifically designed to do the task as fast as possible. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 13:03:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378670#M91062</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-24T13:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: can i transpose in existing datastep rather then using proc transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378677#M91066</link>
      <description>&lt;P&gt;The presence of an ID statement makes this a complex task for a DATA step.&amp;nbsp; It can be done, but requires a fair amount of macro processing ahead of time to identify the values of PARAM (which determine the names of the variables after transposing).&amp;nbsp; I agree with &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;'s conclusion ... better off using the procedure here.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 13:12:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378677#M91066</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-24T13:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: can i transpose in existing datastep rather then using proc transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378682#M91069</link>
      <description>&lt;P&gt;calling &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 13:27:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378682#M91069</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-07-24T13:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: can i transpose in existing datastep rather then using proc transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378684#M91070</link>
      <description>&lt;P&gt;Reason being i have usubjid duplicates and i need all of them and it gets omited in proc transpose. attached is test data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 14:37:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378684#M91070</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2017-07-24T14:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: can i transpose in existing datastep rather then using proc transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378692#M91073</link>
      <description>&lt;P&gt;Then you have a more fundamental problem than wether to use a transpose or not. &amp;nbsp;Core concept of CDISC&amp;nbsp;models is that each record is unique within its row. &amp;nbsp;If you cannot identify a unique record from the data you need to add another category to the SDTM so that you can identify unique records, or have columns for the data that applies to the unique record of data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the case you provide (and I would recommend posting test data in the form of a datastep - i.e. test data, and as a datastep in the {i} code window, just a couple of rows is fine, not actual study data!), What I think your looking for is a summation of the discontinuation reasons across a subject, which I suppose looks like a transpose. &amp;nbsp;I would do it this way:&lt;/P&gt;
&lt;PRE&gt;data want (keep=usubjid reasons);
  set have;
  by usubjid;  /* assumes sorted */
  retain reasons;
  length reasons $2000;
  if first.usubjid then reasons=dsterm;
  else reasons=catx(',',reasons,dsterm);
  if last.usubjid then output;
run;
&lt;/PRE&gt;
&lt;P&gt;This will add each reason to the reatined variable and on the last record for a subject output, so you have one row per subject with all the reasons in one field, which can then be merged onto your other data.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 14:02:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378692#M91073</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-24T14:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: can i transpose in existing datastep rather then using proc transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378704#M91075</link>
      <description>&lt;P&gt;Can you show what you want to get?&amp;nbsp;Please reduce your data to just enough columns and rows to demonstrate the issue and post it into the question using the Insert SAS code icon. &amp;nbsp;So both input and output data. Make sure to include a problem case that has duplicate rows and be clear about how you want it handled.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You also seems to be using the wrong variable for the ID. PARAMCD looks more like a variable name than PARAM which looks like a sentence in your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your ID variables are not enough to uniquely identify rows then you need to add another variable. &amp;nbsp;So you might add a sequence number for each distinct value of UNIQUEID, PARAM.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=adds out=fixed_adds ;
  by usubjid paramcd;
run;
data fixed_adds ;
  by unsubjid paramcd;
  seq+1;
  if first.paramcd then seq=1;
run;

proc transpose data=fixed_adds out=trans_adds ;
by usubjid ;
id paramcd seq;
var avalc;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you will get variables like&amp;nbsp;PRIMREAS1,&amp;nbsp;PRIMREAS2 and&amp;nbsp;SECREAS1,&amp;nbsp;SECREAS2, ...&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 14:27:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378704#M91075</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-24T14:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: can i transpose in existing datastep rather then using proc transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378709#M91076</link>
      <description>&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;other than I presume you will always have a primary reason and, sometimes, secondary reason(s).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so, you&amp;nbsp;might be able to use something as simple as:&lt;/P&gt;
&lt;PRE&gt;proc transpose data=adds out=trans_adds prefix=reasons_for_withdrawal;
  by usubjid ;
  var avalc;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 14:53:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378709#M91076</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-07-24T14:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: can i transpose in existing datastep rather then using proc transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378712#M91077</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/62004"&gt;@vraj1&lt;/a&gt;&amp;nbsp;There is no test data attached?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/62004"&gt;@vraj1&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Reason being i have usubjid duplicates and i need all of them and it gets omited in proc transpose. attached is test data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 14:57:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-i-transpose-in-existing-datastep-rather-then-using-proc/m-p/378712#M91077</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-24T14:57:28Z</dc:date>
    </item>
  </channel>
</rss>

