<?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: inverse of log-ratio transformation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/inverse-of-log-ratio-transformation/m-p/415931#M102097</link>
    <description>&lt;P&gt;You have everything you need in the transformed series, except the starting value, Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title 'Logistic Growth Curve Model of U.S. Population';
data uspop;
   input pop @@;
   retain year 1780;
   year=year+10;
   logPopRatio = log(pop/lag(pop));
   label pop='U.S. Population in Thousands';
   datalines;
3929  5308  7239   9638  12866  17069  23191  31443  39818 50155
62947 75994 91972 105710 122775 131669 151325 179323 203211
226542 248710
;

data usNewPop;
set uspop;
retain lagNewPop;
if _n_ = 1 
    then NewPop = 3929;
    else NewPop = exp(logPopRatio)*lagNewPop;
lagNewPop = NewPop;
drop lagNewPop;
run;

proc print; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 24 Nov 2017 04:46:09 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2017-11-24T04:46:09Z</dc:date>
    <item>
      <title>inverse of log-ratio transformation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/inverse-of-log-ratio-transformation/m-p/415906#M102088</link>
      <description>&lt;P&gt;simple issue driving me nuts!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to do a log-ratio transformation on a variable before regression. The variable is an index (so has values like 450, 560, 1200, etc.). i am&amp;nbsp;doing this in the following way:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var1_T = log(var1/lag(var1))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I want to bring the transformed value to its original form. So wanted to do inverse log like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var1_FCT_Orig = exp(var1_T);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Not working. Can anyone tell me where I am doing this wrong?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2017 00:45:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/inverse-of-log-ratio-transformation/m-p/415906#M102088</guid>
      <dc:creator>eemrun</dc:creator>
      <dc:date>2017-11-24T00:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: inverse of log-ratio transformation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/inverse-of-log-ratio-transformation/m-p/415908#M102090</link>
      <description>&lt;P&gt;When answers don't meet your assumptions, check your assumption.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;EXP is the reverse of LOG.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it gives you:&amp;nbsp;&lt;/P&gt;&lt;PRE class="language-sas lia-code-sample" data-lia-code-lang="sas" data-lia-code-macro="true"&gt;&lt;CODE class="  language-sas"&gt;var1 &lt;SPAN class="token operator"&gt;/ &lt;/SPAN&gt;&lt;SPAN class="token function"&gt;lag&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;var1&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If you want Var1 then you need to multiple by the lag of VAR1 as well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var1_t = log(var1 / lag(var1) );

var1_fct_orig = exp(var1_t) * lag(var1);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The question is, do you have the lagged value to work with as well...&lt;/P&gt;&lt;P&gt;&lt;BR data-mce-bogus="1" /&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/131586"&gt;@eemrun&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;simple issue driving me nuts!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to do a log-ratio transformation on a variable before regression. The variable is an index (so has values like 450, 560, 1200, etc.). i am&amp;nbsp;doing this in the following way:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var1_T = log(var1/lag(var1))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I want to bring the transformed value to its original form. So wanted to do inverse log like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var1_FCT_Orig = exp(var1_T);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Not working. Can anyone tell me where I am doing this wrong?&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR data-mce-bogus="1" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2017 00:54:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/inverse-of-log-ratio-transformation/m-p/415908#M102090</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-24T00:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: inverse of log-ratio transformation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/inverse-of-log-ratio-transformation/m-p/415931#M102097</link>
      <description>&lt;P&gt;You have everything you need in the transformed series, except the starting value, Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title 'Logistic Growth Curve Model of U.S. Population';
data uspop;
   input pop @@;
   retain year 1780;
   year=year+10;
   logPopRatio = log(pop/lag(pop));
   label pop='U.S. Population in Thousands';
   datalines;
3929  5308  7239   9638  12866  17069  23191  31443  39818 50155
62947 75994 91972 105710 122775 131669 151325 179323 203211
226542 248710
;

data usNewPop;
set uspop;
retain lagNewPop;
if _n_ = 1 
    then NewPop = 3929;
    else NewPop = exp(logPopRatio)*lagNewPop;
lagNewPop = NewPop;
drop lagNewPop;
run;

proc print; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Nov 2017 04:46:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/inverse-of-log-ratio-transformation/m-p/415931#M102097</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-11-24T04:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: inverse of log-ratio transformation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/inverse-of-log-ratio-transformation/m-p/416923#M102395</link>
      <description>thanks! that worked perfectly.</description>
      <pubDate>Wed, 29 Nov 2017 01:03:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/inverse-of-log-ratio-transformation/m-p/416923#M102395</guid>
      <dc:creator>eemrun</dc:creator>
      <dc:date>2017-11-29T01:03:35Z</dc:date>
    </item>
  </channel>
</rss>

