<?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 &amp;quot;Transposing&amp;quot; Rows and Columns in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215963#M5233</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;suppose I have the following table consisting of dates and stock prices:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="74" style="border: 1px solid rgb(0, 0, 0); width: 504px; height: 66px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Date&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;A&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;B&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2014-01-07&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2014-01-06&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;8&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to transform it into the following form so that I can calculate the return:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="129" style="border: 1px solid rgb(0, 0, 0); width: 504px; height: 131px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;stock&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;date&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;price&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2014-01-07&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2014-01-06&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2014-01-07&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2014-01-06&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 04 Apr 2015 01:09:10 GMT</pubDate>
    <dc:creator>ilikesas</dc:creator>
    <dc:date>2015-04-04T01:09:10Z</dc:date>
    <item>
      <title>"Transposing" Rows and Columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215963#M5233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;suppose I have the following table consisting of dates and stock prices:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="74" style="border: 1px solid rgb(0, 0, 0); width: 504px; height: 66px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Date&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;A&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;B&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2014-01-07&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2014-01-06&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;8&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to transform it into the following form so that I can calculate the return:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="129" style="border: 1px solid rgb(0, 0, 0); width: 504px; height: 131px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;stock&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;date&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;price&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2014-01-07&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2014-01-06&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2014-01-07&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2014-01-06&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Apr 2015 01:09:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215963#M5233</guid>
      <dc:creator>ilikesas</dc:creator>
      <dc:date>2015-04-04T01:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: "Transposing" Rows and Columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215964#M5234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PROC TRANSPOSE is ideal for jobs like this!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort;&lt;/P&gt;&lt;P&gt;by date;&lt;/P&gt;&lt;P&gt;proc transpose out=want(rename=(_name_=stock col1=price));&lt;/P&gt;&lt;P&gt;var a b;&lt;/P&gt;&lt;P&gt;by date;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Apr 2015 01:33:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215964#M5234</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2015-04-04T01:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: "Transposing" Rows and Columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215965#M5235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom, thanks for the reply!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But in my real case I have hundreds of stocks, so is it possible to put them into the var statement in a manner other than typing each one of them?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Apr 2015 01:41:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215965#M5235</guid>
      <dc:creator>ilikesas</dc:creator>
      <dc:date>2015-04-04T01:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: "Transposing" Rows and Columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215966#M5236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data want(drop=i a b);&lt;/P&gt;&lt;P&gt;retain stock date price;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;array var{*} a b;&lt;/P&gt;&lt;P&gt;do i=1 to dim(var);&lt;/P&gt;&lt;P&gt;price=var{i};&lt;/P&gt;&lt;P&gt;stock=vname(var{i});&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&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 sort data=want;&lt;/P&gt;&lt;P&gt;by stock desending date;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Apr 2015 02:14:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215966#M5236</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2015-04-04T02:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: "Transposing" Rows and Columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215967#M5237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi stat@sas, thanks for the reply!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just have a small issue and it is that in my real data I have hundreds of stocks so it will be very helpful if there was another method of putting them all in the code instead of typing each one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Apr 2015 02:31:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215967#M5237</guid>
      <dc:creator>ilikesas</dc:creator>
      <dc:date>2015-04-04T02:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: "Transposing" Rows and Columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215968#M5238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can group all the numeric or character variables in a data set to an array , without typing each one of them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;array stock{*}&amp;nbsp; _numeric_ ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just replace the array statement in the code by stat@sas . But Make sure&amp;nbsp; other than the stock variables, the remaining should be chars . If they're not char already , make them chars.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Karthik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Apr 2015 03:21:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215968#M5238</guid>
      <dc:creator>Karthikeyan</dc:creator>
      <dc:date>2015-04-04T03:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: "Transposing" Rows and Columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215969#M5239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I realized, by omitting the var statement the code includes all of the variables &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Apr 2015 03:22:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215969#M5239</guid>
      <dc:creator>ilikesas</dc:creator>
      <dc:date>2015-04-04T03:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: "Transposing" Rows and Columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215970#M5240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you're correct, but all I can suggest is give it a try, and post back with any problems.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Apr 2015 03:31:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215970#M5240</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2015-04-04T03:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: "Transposing" Rows and Columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215971#M5241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I actually tried it and it worked, thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Apr 2015 03:33:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/quot-Transposing-quot-Rows-and-Columns/m-p/215971#M5241</guid>
      <dc:creator>ilikesas</dc:creator>
      <dc:date>2015-04-04T03:33:36Z</dc:date>
    </item>
  </channel>
</rss>

