<?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: Create Growth Rates for 41 Variables...Datastep/Loop? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-Growth-Rates-for-41-Variables-Datastep-Loop/m-p/492125#M129281</link>
    <description>&lt;P&gt;You can do it a data step or sql merge with a variable that aligns with the time. A data step merge is better because you can then use arrays.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data want;&lt;/P&gt;
&lt;P&gt;merge have have(firstobs=12 rename = ....rename variables);&lt;/P&gt;
&lt;P&gt;by airport etc;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Array declarations and processes go here.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;run;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will align the first and 12 observation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your airport codes go across, the simplest solution is to transpose it to a long format and then use BY group processing.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Sep 2018 23:22:48 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-09-03T23:22:48Z</dc:date>
    <item>
      <title>Create Growth Rates for 41 Variables...Datastep/Loop?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Growth-Rates-for-41-Variables-Datastep-Loop/m-p/492122#M129278</link>
      <description>&lt;P&gt;I have 41 variables I need to calculate a growth rate for. I have them defined in&amp;nbsp;a macro loop but I don't think it can be done in a datastep.&amp;nbsp; I have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data TAFOASAS.TAM_TWRS_FREQ_ALL_G;
	set EGTASK.TAM_TWRS_FREQ_ALL;
	CYYZ_FREQ_G = CYYZ_FREQ / lag12(CYYZ_FREQ) -1;
	format CYYZ_FREQ_G PERCENT10.2;
	drop cyyz_freq;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;The only thing that changes is the airport code (CYYZ in this case). Can a list be passed to create the growth rate in a loop for each airport?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;thx.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Sep 2018 23:06:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Growth-Rates-for-41-Variables-Datastep-Loop/m-p/492122#M129278</guid>
      <dc:creator>BCNAV</dc:creator>
      <dc:date>2018-09-03T23:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: Create Growth Rates for 41 Variables...Datastep/Loop?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Growth-Rates-for-41-Variables-Datastep-Loop/m-p/492123#M129279</link>
      <description>&lt;P&gt;Can you provide an example of data containing 2 growth variables and 2 airports?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Sep 2018 23:13:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Growth-Rates-for-41-Variables-Datastep-Loop/m-p/492123#M129279</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-09-03T23:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Create Growth Rates for 41 Variables...Datastep/Loop?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Growth-Rates-for-41-Variables-Datastep-Loop/m-p/492125#M129281</link>
      <description>&lt;P&gt;You can do it a data step or sql merge with a variable that aligns with the time. A data step merge is better because you can then use arrays.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data want;&lt;/P&gt;
&lt;P&gt;merge have have(firstobs=12 rename = ....rename variables);&lt;/P&gt;
&lt;P&gt;by airport etc;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Array declarations and processes go here.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;run;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will align the first and 12 observation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your airport codes go across, the simplest solution is to transpose it to a long format and then use BY group processing.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Sep 2018 23:22:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Growth-Rates-for-41-Variables-Datastep-Loop/m-p/492125#M129281</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-03T23:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: Create Growth Rates for 41 Variables...Datastep/Loop?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Growth-Rates-for-41-Variables-Datastep-Loop/m-p/492136#M129287</link>
      <description>&lt;P&gt;If you had stored your data differently, this whole thing could be done simply.&amp;nbsp; Very simply.&amp;nbsp; One DATA step, no macro language.&amp;nbsp; However, you would need to use a better structure for the data.&amp;nbsp; Instead of adding a prefix for each airport name, store each airport's data on separate observations.&amp;nbsp; For example, instead of storing a variable named CYYZ_FREQ, store a variable named FREQ.&amp;nbsp; Also store a variable named AIRPORT.&amp;nbsp; So when AIRPORT is CYYZ, the variable FREQ holds a value related to the frequency for CYYZ airport.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have the data available in that form?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The current structure to the data is just a bad idea.&amp;nbsp; It turns an easy problem into a difficult one, not just for this application but for most every application that uses this data.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Sep 2018 01:01:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Growth-Rates-for-41-Variables-Datastep-Loop/m-p/492136#M129287</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-09-04T01:01:03Z</dc:date>
    </item>
  </channel>
</rss>

