<?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: is there a way of creating a loop to do the same work this code is doing for 187 firms? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/is-there-a-way-of-creating-a-loop-to-do-the-same-work-this-code/m-p/340203#M63219</link>
    <description>&lt;P&gt;Thanks, it worked fine!!!&lt;/P&gt;&lt;P&gt;Is it possible to explain how the arrays' part work in this code?&lt;/P&gt;</description>
    <pubDate>Sun, 12 Mar 2017 00:35:33 GMT</pubDate>
    <dc:creator>sasnewuser1</dc:creator>
    <dc:date>2017-03-12T00:35:33Z</dc:date>
    <item>
      <title>is there a way of creating a loop to do the same work this code is doing for 187 firms?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/is-there-a-way-of-creating-a-loop-to-do-the-same-work-this-code/m-p/340138#M63212</link>
      <description>&lt;P&gt;I have my data in the excel sheet as the following:&lt;/P&gt;&lt;P&gt;company_ticker_1 date_1 price_1 return_1 dividend_1 ( )&amp;nbsp;&lt;SPAN&gt;....company_ticker_187 date_187 price_187 return_187 dividend_187&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1 &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;12&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 ( ) ....187 &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;9 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 13 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1&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; 12&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 ( )&lt;/SPAN&gt;&lt;SPAN&gt;.... 187&lt;/SPAN&gt;&lt;SPAN&gt;&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; 9&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1&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; 12&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 ( )&lt;/SPAN&gt;&lt;SPAN&gt;.... 187&lt;/SPAN&gt;&lt;SPAN&gt;&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; 10 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 11&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and i want to convert my data to this format&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;company_ticker date price return dividend&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1 &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;12 &amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1 &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; 12&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1 &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;12&amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2 &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; 3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;8 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2 &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; 3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;187&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;10 &amp;nbsp; &amp;nbsp;11&amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried to do it for the two company's with this code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;CREATE table data as&lt;BR /&gt;SELECT Company_Ticker,Date,PX_LAST,DAY_TO_DAY_TOT_RETURN_GROSS_DVDS,EQY_DPS&lt;BR /&gt;FROM test&lt;BR /&gt;where date is not null;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;CREATE view new_view_1 AS&lt;BR /&gt;SELECT Company_Ticker_1 as Company_Ticker , Date_1 as date,PX_LAST_1 as PX_LAST , DAY_TO_DAY_TOT_RETURN_GROSS_DVD1 as DAY_TO_DAY_TOT_RETURN_GROSS_DVDS,EQY_DPS_1 as EQY_DPS&lt;BR /&gt;FROM test&lt;BR /&gt;where Date_1 is not null;&lt;BR /&gt;quit;&lt;BR /&gt;proc append base=data data=new_view_1 force;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;CREATE view new_view_2 AS&lt;BR /&gt;SELECT Company_Ticker_2 as Company_Ticker , Date_2 as date,PX_LAST_1 as PX_LAST , DAY_TO_DAY_TOT_RETURN_GROSS_DVD2 as DAY_TO_DAY_TOT_RETURN_GROSS_DVDS,EQY_DPS_2 as EQY_DPS&lt;BR /&gt;FROM test&lt;BR /&gt;where Date_2 is not null;&lt;BR /&gt;quit;&lt;BR /&gt;proc append base=data data=new_view_2 force;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;CREATE view new_view_3 AS&lt;BR /&gt;SELECT Company_Ticker_1 as Company_Ticker , Date_3 as date,PX_LAST_3 as PX_LAST , DAY_TO_DAY_TOT_RETURN_GROSS_DVD1 as DAY_TO_DAY_TOT_RETURN_GROSS_DVDS,EQY_DPS_3 as EQY_DPS&lt;BR /&gt;FROM test&lt;BR /&gt;where Date_3 is not null;&lt;BR /&gt;quit;&lt;BR /&gt;proc append base=data data=new_view_3 force;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can we create a loop that&amp;nbsp;does the job i'm repeating 9in this case for 3 companies but i have to dit for more)?&lt;/P&gt;&lt;P&gt;Or is there even a better way to do it?&lt;/P&gt;&lt;P&gt;Thank you all&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2017 00:25:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/is-there-a-way-of-creating-a-loop-to-do-the-same-work-this-code/m-p/340138#M63212</guid>
      <dc:creator>sasnewuser1</dc:creator>
      <dc:date>2017-03-11T00:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way of creating a loop to do the same work this code is doing for 187 firms?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/is-there-a-way-of-creating-a-loop-to-do-the-same-work-this-code/m-p/340140#M63213</link>
      <description>&lt;P&gt;This can probably be done with a lot less coding using the data step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want (keep=company_ticker date price return dividend);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; array ct {187}&amp;nbsp; company_ticker_1-company_ticker_187;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; array dt {187}&amp;nbsp; date_1-date_187;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; array&amp;nbsp;p &amp;nbsp;{187}&amp;nbsp; price_1-price_187;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; array ret {187}&amp;nbsp; return_1-return_187;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; array div {187} dividend_1-divident_187;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; do I=1 to 187;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; company_ticker=ct{I};&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; date=date{I};&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; price=p{i};&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return=ret{i};&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dividend=div{i};&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2017 01:20:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/is-there-a-way-of-creating-a-loop-to-do-the-same-work-this-code/m-p/340140#M63213</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-03-11T01:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way of creating a loop to do the same work this code is doing for 187 firms?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/is-there-a-way-of-creating-a-loop-to-do-the-same-work-this-code/m-p/340203#M63219</link>
      <description>&lt;P&gt;Thanks, it worked fine!!!&lt;/P&gt;&lt;P&gt;Is it possible to explain how the arrays' part work in this code?&lt;/P&gt;</description>
      <pubDate>Sun, 12 Mar 2017 00:35:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/is-there-a-way-of-creating-a-loop-to-do-the-same-work-this-code/m-p/340203#M63219</guid>
      <dc:creator>sasnewuser1</dc:creator>
      <dc:date>2017-03-12T00:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way of creating a loop to do the same work this code is doing for 187 firms?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/is-there-a-way-of-creating-a-loop-to-do-the-same-work-this-code/m-p/340237#M63223</link>
      <description>&lt;P&gt;Do a google search for&lt;BR /&gt;&amp;nbsp;&amp;nbsp; sas samples arrays&lt;/P&gt;
&lt;P&gt;and you'll see lots of likely explanatory documents.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The one at the top of my google results is&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/sugi30/242-30.pdf" target="_self"&gt;Arrays Made Easy: An Introduction to Arrays and Array Processing&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And there are plenty more.&lt;/P&gt;</description>
      <pubDate>Sun, 12 Mar 2017 16:37:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/is-there-a-way-of-creating-a-loop-to-do-the-same-work-this-code/m-p/340237#M63223</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-03-12T16:37:41Z</dc:date>
    </item>
  </channel>
</rss>

