<?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 something wrong with my code here? My data is importing but I think my code is wrong syntax w in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538861#M148376</link>
    <description>I'm getting errors that say: Invalid argument to function LOG(-0.8) at line 433 column 11. I looked at that line and column and I'm not sure what's wrong with it?</description>
    <pubDate>Wed, 27 Feb 2019 00:48:12 GMT</pubDate>
    <dc:creator>khalillx</dc:creator>
    <dc:date>2019-02-27T00:48:12Z</dc:date>
    <item>
      <title>Is something wrong with my code here? My data is importing but I think my code is wrong syntax wise</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538859#M148374</link>
      <description>&lt;P&gt;data one;&lt;BR /&gt;set project1;&lt;BR /&gt;consg = (consumption*42)/Population;&lt;BR /&gt;pce0 = PCE/78.23517;&lt;BR /&gt;rpgas = Price/pce0;&lt;BR /&gt;logrpgas = log(rpgas);&lt;BR /&gt;logconsg = log(consg);&lt;BR /&gt;logincome = log(income);&lt;BR /&gt;logPCE_lag = log(PCE_lag);&lt;BR /&gt;logUnemployment = log(Unemployment);&lt;BR /&gt;logOneyear = log(Oneyear);&lt;BR /&gt;num_mon= month (observation_date);&lt;BR /&gt;If num_mon=1 then dumjan=1; else dumjan=0;&lt;BR /&gt;If num_mon=2 then dumfeb=1;else dumfeb=0;&lt;BR /&gt;If num_mon=3 then dummar=1;else dummar=0;&lt;BR /&gt;If num_mon=4 then dumapr=1;else dumapr=0;&lt;BR /&gt;If num_mon=5 then dummay=1;else dummay=0;&lt;BR /&gt;If num_mon=6 then dumjun=1;else dumjun=0;&lt;BR /&gt;If num_mon=7 then dumjul=1;else dumjul=0;&lt;BR /&gt;If num_mon=8 then dumaug=1;else dumaug=0;&lt;BR /&gt;If num_mon=9 then dumsep=1; else dumsep=0;&lt;BR /&gt;If num_mon=10 then dumoct=1; else dumoct=0;&lt;BR /&gt;If num_mon=11 then dumnov=1; else dumnov=0;&lt;BR /&gt;If num_mon=12 then dumdec=1; else dumdec=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is this how you take logs of variables and set dummy variables? The reason I ask is because this is the format in sas studios but SAS 9.4 might be different.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 00:40:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538859#M148374</guid>
      <dc:creator>khalillx</dc:creator>
      <dc:date>2019-02-27T00:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Is something wrong with my code here? My data is importing but I think my code is wrong syntax w</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538860#M148375</link>
      <description>&lt;P&gt;I can't see anything immediatly wrong with it.&lt;/P&gt;&lt;P&gt;I assume you also have a run; statement at the end of the code .&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you getting any errors in your logs?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is the output as you expect ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 00:45:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538860#M148375</guid>
      <dc:creator>34reqrwe</dc:creator>
      <dc:date>2019-02-27T00:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Is something wrong with my code here? My data is importing but I think my code is wrong syntax w</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538861#M148376</link>
      <description>I'm getting errors that say: Invalid argument to function LOG(-0.8) at line 433 column 11. I looked at that line and column and I'm not sure what's wrong with it?</description>
      <pubDate>Wed, 27 Feb 2019 00:48:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538861#M148376</guid>
      <dc:creator>khalillx</dc:creator>
      <dc:date>2019-02-27T00:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: Is something wrong with my code here? My data is importing but I think my code is wrong syntax w</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538862#M148377</link>
      <description>&lt;P&gt;do you know what the LOG function does?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 00:49:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538862#M148377</guid>
      <dc:creator>34reqrwe</dc:creator>
      <dc:date>2019-02-27T00:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is something wrong with my code here? My data is importing but I think my code is wrong syntax w</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538863#M148378</link>
      <description>Yeah it turns my values into percent form.</description>
      <pubDate>Wed, 27 Feb 2019 00:50:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538863#M148378</guid>
      <dc:creator>khalillx</dc:creator>
      <dc:date>2019-02-27T00:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Is something wrong with my code here? My data is importing but I think my code is wrong syntax w</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538864#M148379</link>
      <description>&lt;P&gt;No it doesn't . I suggest you check out google.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 00:52:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538864#M148379</guid>
      <dc:creator>34reqrwe</dc:creator>
      <dc:date>2019-02-27T00:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: Is something wrong with my code here? My data is importing but I think my code is wrong syntax w</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538865#M148380</link>
      <description>Yes it does.</description>
      <pubDate>Wed, 27 Feb 2019 00:55:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538865#M148380</guid>
      <dc:creator>khalillx</dc:creator>
      <dc:date>2019-02-27T00:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Is something wrong with my code here? My data is importing but I think my code is wrong syntax w</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538872#M148386</link>
      <description>&lt;P&gt;Some clarifications for you, SAS UE is running SAS 9.4 TS1M6 at the moment. This is the same as SAS 9.4. There are some differences between using SAS UE and one on your desktop but it's more related to file paths than any type of functionality about your actual code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regarding LOG:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Yeah it turns my values into percent form.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The log function most definitely does not convert a number to a percent, it takes the natural log of a number. Most likely you're getting errors because you can't take the log of a negative, zero or missing value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H1 id="p0urbseuxrkrlyn1tr04y30nt25s" class="xis-title"&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;LOG Function&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H1&gt;
&lt;P class="xis-shortDescription"&gt;Returns the natural (base e) logarithm.&lt;/P&gt;
&lt;P class="xis-shortDescription"&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p0urbseuxrkrlyn1tr04y30nt25s.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p0urbseuxrkrlyn1tr04y30nt25s.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P class="xis-shortDescription"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="xis-shortDescription"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="xis-shortDescription"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="xis-shortDescription"&gt;Regarding creating the dummy variables, you could simplify that by using an array, see the examples here, specifically see the example titled "Computing New Variables"&lt;/P&gt;
&lt;P class="xis-shortDescription"&gt;&lt;A href="https://stats.idre.ucla.edu/sas/seminars/sas-arrays/" target="_blank" rel="noopener"&gt;https://stats.idre.ucla.edu/sas/seminars/sas-arrays/&lt;/A&gt;&lt;/P&gt;
&lt;P class="xis-shortDescription"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="xis-shortDescription"&gt;When you're having issues with your code, it's helpful if you include the log that shows what errors you're encountering.&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;data one;&lt;BR /&gt;set project1;&lt;BR /&gt;consg = (consumption*42)/Population;&lt;BR /&gt;pce0 = PCE/78.23517;&lt;BR /&gt;rpgas = Price/pce0;&lt;BR /&gt;logrpgas = log(rpgas);&lt;BR /&gt;logconsg = log(consg);&lt;BR /&gt;logincome = log(income);&lt;BR /&gt;logPCE_lag = log(PCE_lag);&lt;BR /&gt;logUnemployment = log(Unemployment);&lt;BR /&gt;logOneyear = log(Oneyear);&lt;BR /&gt;num_mon= month (observation_date);&lt;BR /&gt;If num_mon=1 then dumjan=1; else dumjan=0;&lt;BR /&gt;If num_mon=2 then dumfeb=1;else dumfeb=0;&lt;BR /&gt;If num_mon=3 then dummar=1;else dummar=0;&lt;BR /&gt;If num_mon=4 then dumapr=1;else dumapr=0;&lt;BR /&gt;If num_mon=5 then dummay=1;else dummay=0;&lt;BR /&gt;If num_mon=6 then dumjun=1;else dumjun=0;&lt;BR /&gt;If num_mon=7 then dumjul=1;else dumjul=0;&lt;BR /&gt;If num_mon=8 then dumaug=1;else dumaug=0;&lt;BR /&gt;If num_mon=9 then dumsep=1; else dumsep=0;&lt;BR /&gt;If num_mon=10 then dumoct=1; else dumoct=0;&lt;BR /&gt;If num_mon=11 then dumnov=1; else dumnov=0;&lt;BR /&gt;If num_mon=12 then dumdec=1; else dumdec=0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is this how you take logs of variables and set dummy variables? The reason I ask is because this is the format in sas studios but SAS 9.4 might be different.&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P class="xis-shortDescription"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="xis-shortDescription"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 02:36:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538872#M148386</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-27T02:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: Is something wrong with my code here? My data is importing but I think my code is wrong syntax w</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538875#M148388</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;If num_mon=1 then dumjan=1; else dumjan=0;
If num_mon=2 then dumfeb=1;else dumfeb=0;
If num_mon=3 then dummar=1;else dummar=0;
If num_mon=4 then dumapr=1;else dumapr=0;
If num_mon=5 then dummay=1;else dummay=0;
If num_mon=6 then dumjun=1;else dumjun=0;
If num_mon=7 then dumjul=1;else dumjul=0;
If num_mon=8 then dumaug=1;else dumaug=0;
If num_mon=9 then dumsep=1; else dumsep=0;
If num_mon=10 then dumoct=1; else dumoct=0;
If num_mon=11 then dumnov=1; else dumnov=0;
If num_mon=12 then dumdec=1; else dumdec=0;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;A comparison operator returns a boolean result, i.e. false=0, true=1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the above can be shortened to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;dumjan = (num_mon=1);
dumfeb = (num_mon=2);
dummar = (num_mon=3);
dumapr = (num_mon=4);
dummay = (num_mon=5);
dumjun = (num_mon=6);
dumjul = (num_mon=7);
dumaug = (num_mon=8);
dumsep = (num_mon=9);
dumoct = (num_mon=10);
dumnov = (num_mon=11);
dumdec = (num_mon=12);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Which can be further shortened to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array months {12} dumjan dumfeb dummar dumapr dummay dumjun dumjul dumaug dumsep dumoct dumnov dumdec;

do i=1 to 12;  (or do i=1 to dim(months))
   months{i}=(num_mon=i);
end;   &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Feb 2019 03:37:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-something-wrong-with-my-code-here-My-data-is-importing-but-I/m-p/538875#M148388</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-02-27T03:37:28Z</dc:date>
    </item>
  </channel>
</rss>

