<?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: transposing of variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356831#M83729</link>
    <description>&lt;P&gt;As I mentioned above, CDISC metadata library is a downloadable file from their website, and shortly via a database link (SHARE I think its called). &amp;nbsp;And SAS already has a metadata library, VTable/VColumn. &amp;nbsp;So the question persists, why do this yourself? &amp;nbsp;Also, you may find that lists aren't very helpful, try sticking with the normlised veiw of the metadata (i.e. goes down rather than across), easier to work with, e.g.:&lt;/P&gt;
&lt;P&gt;NAME TYPE LENGTH CODELIST..&lt;/P&gt;</description>
    <pubDate>Mon, 08 May 2017 11:34:50 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-05-08T11:34:50Z</dc:date>
    <item>
      <title>transposing of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356809#M83716</link>
      <description>&lt;P&gt;&amp;nbsp;Hi,&lt;/P&gt;&lt;P&gt;I have a dataset (attached sampple data) and i need to transpose them like below:&lt;/P&gt;&lt;P&gt;LABRARY &amp;nbsp; &amp;nbsp; MEM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;col1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; col2&lt;/P&gt;&lt;P&gt;CTRL &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TAN &amp;nbsp; &amp;nbsp; "ETCD","EPOCH","ELEMENT","DOMAIN","ARMCD" &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "ETCD","EPOCH","ELEMENT","DOMAIN","ARMCD"&lt;/P&gt;&lt;P&gt;CTRL &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TS&lt;/P&gt;&lt;P&gt;it should be transposed by labrary and mem and concatenate all col variables into one as col1 and all nami variables as col2(concatinated).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope my question is clear. any help?&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 08:48:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356809#M83716</guid>
      <dc:creator>alexdsa310</dc:creator>
      <dc:date>2017-05-08T08:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: transposing of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356811#M83717</link>
      <description>&lt;P&gt;Sort and use a data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=incd;
by labrary mem;
run;

data want (keep=labrary mem col1 col2);
set incd;
by labrary mem;
length col1 col2 $100;
retain col1 col2;
if first.mem
then do;
  col1 = '';
  col2 = '';
end;
col1 = catx(',',col1,col);
col2 = catx(',',col2,nami);
if last.mem then output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 May 2017 08:56:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356811#M83717</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-05-08T08:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: transposing of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356812#M83718</link>
      <description>&lt;P&gt;Post your sample data in the form of a datastep.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use PROC TRANSPOSE to solve this problem, examples are given in the documentation here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#n0go3r6yhe1zpvn1mrf6hjw6f40g.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#n0go3r6yhe1zpvn1mrf6hjw6f40g.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 08:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356812#M83718</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-05-08T08:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: transposing of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356813#M83719</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;: the attached .sas file contains the data step with the example data. Since it's about 200 lines of data, it was prudent to use a text file attachment for posting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can TRANSPOSE be used to create variables with concatenated character values?&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 09:02:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356813#M83719</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-05-08T09:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: transposing of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356815#M83720</link>
      <description>&lt;P&gt;Alex,&lt;/P&gt;&lt;P&gt;I think this does what you want:&lt;/P&gt;&lt;PRE&gt;proc sort data=incd;
  by labrary mem descending col;
run;

data want;
  do until(last.mem);
    set incd;
    by labrary mem;
    length col1 col2 $200;
    call catx(',',col1,put(col,$quote20.));
    call catx(',',col2,put(nami,$quote20.));
    end;
  keep labrary mem col1 col2;
run;&lt;/PRE&gt;&lt;P&gt;I put in the "descending col" in the PROC SORT, because your example output COL1 was sorted by descending values - you can drop&amp;nbsp;it if that's not a requirement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the CALL CATX routines because they are much more efficient that the CATX function for cases like this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Søren&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 09:09:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356815#M83720</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2017-05-08T09:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: transposing of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356816#M83721</link>
      <description>&lt;P&gt;Thanks soren,&lt;/P&gt;&lt;P&gt;a quick question can i keep " " quotes for each variable in the list of col1 and col2 like&amp;nbsp;&lt;/P&gt;&lt;P&gt;col1&lt;/P&gt;&lt;P&gt;"TABLE","INC","JUY","OIP"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 09:15:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356816#M83721</guid>
      <dc:creator>alexdsa310</dc:creator>
      <dc:date>2017-05-08T09:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: transposing of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356817#M83722</link>
      <description>Yes, that's what the $quote format does</description>
      <pubDate>Mon, 08 May 2017 09:21:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356817#M83722</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2017-05-08T09:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: transposing of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356819#M83723</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;, I stand corrected, missread this thread completely &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 09:32:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356819#M83723</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-05-08T09:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: transposing of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356822#M83725</link>
      <description>&lt;P&gt;Out of interest, what is it your doing. &amp;nbsp;That looks like SDTM data your dealing with, so why would you need to get a list of variable names? &amp;nbsp;You will of course already have a metadata store, called define.xml - and you would likely have some sort of company standards/CDISC standards?&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 09:35:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356822#M83725</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-05-08T09:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: transposing of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356829#M83727</link>
      <description>&lt;P&gt;HI Soren,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to add another variable in by but not with success. i also want to have grouping basis on&lt;/P&gt;&lt;PRE&gt;labrary mem orig &lt;/PRE&gt;&lt;P&gt;any suggestion.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc sort data=incd;
  by labrary mem orig descending col;
run;

data want;
  do until(last.mem);
    set incd;
    by labrary mem orig;
    length col1 col2 $200;
    call catx(',',col1,put(col,$quote20.));
    call catx(',',col2,put(nami,$quote20.));
    end;
  keep labrary mem col1 col2;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 11:44:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356829#M83727</guid>
      <dc:creator>alexdsa310</dc:creator>
      <dc:date>2017-05-08T11:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: transposing of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356830#M83728</link>
      <description>&lt;P&gt;i am creating metadata library and hence need this type of output dataset. yes the data is SDTM&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 11:26:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356830#M83728</guid>
      <dc:creator>alexdsa310</dc:creator>
      <dc:date>2017-05-08T11:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: transposing of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356831#M83729</link>
      <description>&lt;P&gt;As I mentioned above, CDISC metadata library is a downloadable file from their website, and shortly via a database link (SHARE I think its called). &amp;nbsp;And SAS already has a metadata library, VTable/VColumn. &amp;nbsp;So the question persists, why do this yourself? &amp;nbsp;Also, you may find that lists aren't very helpful, try sticking with the normlised veiw of the metadata (i.e. goes down rather than across), easier to work with, e.g.:&lt;/P&gt;
&lt;P&gt;NAME TYPE LENGTH CODELIST..&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 11:34:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/transposing-of-variables/m-p/356831#M83729</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-05-08T11:34:50Z</dc:date>
    </item>
  </channel>
</rss>

