<?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: Rows to observations and observation to rows by arrays in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Rows-to-observations-and-observation-to-rows-by-arrays/m-p/133240#M260795</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes Jerry, thanks for your response. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i want to achieve this by arrays. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because i tried with transpose and got the desired output, even without the use of var statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc transpose data=have out=trans;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;jagadish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Nov 2013 02:35:30 GMT</pubDate>
    <dc:creator>Jagadishkatam</dc:creator>
    <dc:date>2013-11-06T02:35:30Z</dc:date>
    <item>
      <title>Rows to observations and observation to rows by arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rows-to-observations-and-observation-to-rows-by-arrays/m-p/133238#M260793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could anyone please let me know, how we can convert the below data (this is a sample data)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a b c&lt;/P&gt;&lt;P&gt;1 2 3&lt;/P&gt;&lt;P&gt;4 5 6 &lt;/P&gt;&lt;P&gt;7 8 9&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;desired output&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a b c&lt;/P&gt;&lt;P&gt;1 4 7&lt;/P&gt;&lt;P&gt;2 5 8 &lt;/P&gt;&lt;P&gt;3 6 9&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate your responses.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jagadish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Nov 2013 01:59:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rows-to-observations-and-observation-to-rows-by-arrays/m-p/133238#M260793</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2013-11-06T01:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: Rows to observations and observation to rows by arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rows-to-observations-and-observation-to-rows-by-arrays/m-p/133239#M260794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you really want to use arrays?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using Proc Transpose...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input a b c;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1 2 3&lt;/P&gt;&lt;P&gt;4 5 6&lt;/P&gt;&lt;P&gt;7 8 9&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc transpose data=have&amp;nbsp; out=want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var a b c;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How best to name/rename the transposed columns will depend on your real data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Nov 2013 02:27:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rows-to-observations-and-observation-to-rows-by-arrays/m-p/133239#M260794</guid>
      <dc:creator>JerryLeBreton</dc:creator>
      <dc:date>2013-11-06T02:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: Rows to observations and observation to rows by arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rows-to-observations-and-observation-to-rows-by-arrays/m-p/133240#M260795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes Jerry, thanks for your response. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i want to achieve this by arrays. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because i tried with transpose and got the desired output, even without the use of var statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc transpose data=have out=trans;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;jagadish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Nov 2013 02:35:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rows-to-observations-and-observation-to-rows-by-arrays/m-p/133240#M260795</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2013-11-06T02:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Rows to observations and observation to rows by arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rows-to-observations-and-observation-to-rows-by-arrays/m-p/133241#M260796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have big enough memory to hold the whole table, then you can try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input a b c;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1 2 3&lt;/P&gt;&lt;P&gt;4 5 6&lt;/P&gt;&lt;P&gt;7 8 9&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql NOPRINT;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select nobs into :nobs TRIMMED from dictionary.tables where LIBNAME='WORK' AND MEMNAME='HAVE';&lt;/P&gt;&lt;P&gt;&amp;nbsp; SELECT NVAR INTO :NVAR TRIMMED FROM DICTIONARY.TABLES WHERE LIBNAME='WORK' AND MEMNAME='HAVE';&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have end=last nobs=nobs;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; array t1 a b c;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; array t2(&amp;amp;nobs,&amp;amp;nvar) _temporary_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do over t1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t2(_n_,_i_)=t1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if last then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do _n_=1 to nobs;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do over t1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; t1=t2(_i_,_n_);&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: if your nobs not equal to your nvar, then the code needs to be tweaked a bit, basically you would need to define another array for the new vars.&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Nov 2013 04:55:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rows-to-observations-and-observation-to-rows-by-arrays/m-p/133241#M260796</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-11-06T04:55:02Z</dc:date>
    </item>
  </channel>
</rss>

