<?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 How to estimate the growth in a dataset like this one in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-estimate-the-growth-in-a-dataset-like-this-one/m-p/906343#M44024</link>
    <description>&lt;P&gt;How do we estimate the growth for written premium (wp) , Earned Unit (EU) and Written Unit (WU) from 2022 to 2023 with a dataset structured like below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA new_dataset;
INPUT AN WP EU WU;
DATALINES;
2022 1000 1500 1700
2023 1500 1550 1800
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Dec 2023 21:35:34 GMT</pubDate>
    <dc:creator>alepage</dc:creator>
    <dc:date>2023-12-05T21:35:34Z</dc:date>
    <item>
      <title>How to estimate the growth in a dataset like this one</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-estimate-the-growth-in-a-dataset-like-this-one/m-p/906343#M44024</link>
      <description>&lt;P&gt;How do we estimate the growth for written premium (wp) , Earned Unit (EU) and Written Unit (WU) from 2022 to 2023 with a dataset structured like below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA new_dataset;
INPUT AN WP EU WU;
DATALINES;
2022 1000 1500 1700
2023 1500 1550 1800
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 21:35:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-estimate-the-growth-in-a-dataset-like-this-one/m-p/906343#M44024</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-12-05T21:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to estimate the growth in a dataset like this one</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-estimate-the-growth-in-a-dataset-like-this-one/m-p/906361#M44025</link>
      <description>&lt;P&gt;What would the result look like? And what if the value does not increase?&lt;/P&gt;
&lt;P&gt;If you have multiple years do you want a year-to-year change or over the time period of record?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does your actual data have something else, perhaps an identifier as to what product or client name that groups records together (goes to a better fit of a solution to actual problem)?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 07:09:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-estimate-the-growth-in-a-dataset-like-this-one/m-p/906361#M44025</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-12-06T07:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to estimate the growth in a dataset like this one</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-estimate-the-growth-in-a-dataset-like-this-one/m-p/906362#M44026</link>
      <description>With just year over year change you can't quite make predictions in my opinion, in this case you get more into the art method of predictions than science.</description>
      <pubDate>Tue, 05 Dec 2023 22:28:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-estimate-the-growth-in-a-dataset-like-this-one/m-p/906362#M44026</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-12-05T22:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to estimate the growth in a dataset like this one</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-estimate-the-growth-in-a-dataset-like-this-one/m-p/906456#M44030</link>
      <description>&lt;P&gt;Sorry, may be I was not clear enough.&amp;nbsp; I just want to estimate the variation of three variable from the previous year to the current year, like below.&amp;nbsp; You may have many administrative center and type3 class but the dataset structure will be like below.&amp;nbsp; The result dataset is the one I would like to have.&amp;nbsp; What's the best way to do that ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA new_dataset;
INPUT AN CTRADM $ TYPE3 WP EU WU;
DATALINES;
2022 ABL 23 1000 1500 1700
2023 ABL 23 1500 1550 1800
2022 ABL 31.1 800 800 800
2023 ABL 31.1 1000 950 900

;
RUN;

DATA Result;
INPUT AN CTRADM $ TYPE3 WP growth_WP EU growth_EU WU growth_WU;
DATALINES;

2023 ABL 23 1500 0.5 1550 0.033 1800 0.058
2023 ABL 31.1 1000 0.25 950 0.1875 900 0.125
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Dec 2023 15:17:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-estimate-the-growth-in-a-dataset-like-this-one/m-p/906456#M44030</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-12-06T15:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to estimate the growth in a dataset like this one</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-estimate-the-growth-in-a-dataset-like-this-one/m-p/906484#M44031</link>
      <description>&lt;PRE&gt;data result;
   set new_dataset;
   by ctradm type3;
   growth_wp= dif(wp)/lag(wp);
   growth_eu= dif(eu)/lag(eu);
   growth_wu= dif(wu)/lag(wu);
   if last.type3;
run;&lt;/PRE&gt;
&lt;P&gt;For your given data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What this does:&lt;/P&gt;
&lt;P&gt;The DIF function calculates the difference for a variable from the previous observation, lag gets the value of the variable for the previous observation. You can actual get the value from more than the previous: DIF4 gets the difference between the current and the 4th previous observation.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Caveat:&lt;/STRONG&gt; Previous is within a queued value group. So when used with "if" or similar conditions the "previous" is the previous time the condition is true.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will result in notes in the log about missing values because on the first observation is there no "previous" value to use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The BY statement creates automatic variables that indicate to SAS whether the current observation is the first or last of a by group. The values are accessed with the syntax FIRST.VARIABLE or LAST.VARIABLE and are valued as 1 for true and 0 for false. So IF statements like 'if first.variable then ...' execute ;&lt;/P&gt;
&lt;P&gt;The IF used above is a subsetting IF so that only the observation with the last of the TYPE3 is written to the output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Caution: Your example data implies a sort order by Type3. If this is not the actual case but the data is grouped as need then add NOTSORTED to the BY statement to prevent errors.&lt;/P&gt;
&lt;P&gt;Or sort the data by CTRADM TYPE3 AN prior to this step.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 18:14:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-estimate-the-growth-in-a-dataset-like-this-one/m-p/906484#M44031</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-12-06T18:14:48Z</dc:date>
    </item>
  </channel>
</rss>

