<?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 A simple final exam question in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623243#M183441</link>
    <description>&lt;P class="p1"&gt;The following SAS code includes three mistakes that would stop it from working. Identify each of the mistakes:&lt;/P&gt;&lt;P class="p1"&gt;DATA = Production;&lt;/P&gt;&lt;P class="p1"&gt;SET Factory.Production&lt;/P&gt;&lt;P class="p1"&gt;Total = Sum(of Daily-Daily365);&lt;/P&gt;&lt;P class="p1"&gt;If Month = January THEN Current = Yes;&lt;/P&gt;&lt;P class="p1"&gt;RUN&lt;/P&gt;&lt;P class="p2"&gt;(30 points)&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;Thank you for proving me an answer.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 08 Feb 2020 01:02:44 GMT</pubDate>
    <dc:creator>zhongnanzi</dc:creator>
    <dc:date>2020-02-08T01:02:44Z</dc:date>
    <item>
      <title>A simple final exam question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623243#M183441</link>
      <description>&lt;P class="p1"&gt;The following SAS code includes three mistakes that would stop it from working. Identify each of the mistakes:&lt;/P&gt;&lt;P class="p1"&gt;DATA = Production;&lt;/P&gt;&lt;P class="p1"&gt;SET Factory.Production&lt;/P&gt;&lt;P class="p1"&gt;Total = Sum(of Daily-Daily365);&lt;/P&gt;&lt;P class="p1"&gt;If Month = January THEN Current = Yes;&lt;/P&gt;&lt;P class="p1"&gt;RUN&lt;/P&gt;&lt;P class="p2"&gt;(30 points)&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;Thank you for proving me an answer.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Feb 2020 01:02:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623243#M183441</guid>
      <dc:creator>zhongnanzi</dc:creator>
      <dc:date>2020-02-08T01:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: A simple final exam question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623244#M183442</link>
      <description>&lt;P class="p1"&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;DATA = Production;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="p1"&gt;SET Factory.Production&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Total = Sum(of Daily-Daily365);&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="p1"&gt;If Month = &lt;FONT color="#FF0000"&gt;January&lt;/FONT&gt; THEN Current = &lt;FONT color="#FF0000"&gt;Yes;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="p1"&gt;RUN&lt;FONT color="#FF0000"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Feb 2020 01:11:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623244#M183442</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-02-08T01:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: A simple final exam question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623259#M183451</link>
      <description>&lt;P class="p1"&gt;DATA &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;=&lt;/STRONG&gt;&lt;/FONT&gt; Production;&lt;/P&gt;
&lt;P class="p1"&gt;SET Factory.Production &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="p1"&gt;Total = Sum(of Daily-Daily365);&lt;/P&gt;
&lt;P class="p1"&gt;If Month = January THEN Current = Yes;&lt;/P&gt;
&lt;P class="p1"&gt;RUN &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Feb 2020 03:04:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623259#M183451</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-02-08T03:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: A simple final exam question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623260#M183452</link>
      <description>&lt;P&gt;Thanks！！&lt;/P&gt;</description>
      <pubDate>Sat, 08 Feb 2020 03:09:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623260#M183452</guid>
      <dc:creator>zhongnanzi</dc:creator>
      <dc:date>2020-02-08T03:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: A simple final exam question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623261#M183453</link>
      <description>&lt;P&gt;Thanks！&lt;/P&gt;</description>
      <pubDate>Sat, 08 Feb 2020 03:12:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623261#M183453</guid>
      <dc:creator>zhongnanzi</dc:creator>
      <dc:date>2020-02-08T03:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: A simple final exam question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623262#M183454</link>
      <description>&lt;P&gt;One more question，what‘s wrong with this statement？&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Total = Sum(of Daily-Daily365);&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Feb 2020 03:13:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623262#M183454</guid>
      <dc:creator>zhongnanzi</dc:creator>
      <dc:date>2020-02-08T03:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: A simple final exam question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623268#M183459</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/311140"&gt;@zhongnanzi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;One more question，what‘s wrong with this statement？&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;Total = Sum(of Daily-Daily365);&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Look carefully at the statement.&amp;nbsp; Tell us what you THINK it means.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Feb 2020 04:40:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623268#M183459</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-02-08T04:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: A simple final exam question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623307#M183480</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/311140"&gt;@zhongnanzi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P class="p1"&gt;The following SAS code includes three mistakes that would stop it from working. Identify each of the mistakes:&lt;/P&gt;
&lt;P class="p1"&gt;DATA = Production;&lt;/P&gt;
&lt;P class="p1"&gt;SET Factory.Production&lt;/P&gt;
&lt;P class="p1"&gt;Total = Sum(of Daily-Daily365);&lt;/P&gt;
&lt;P class="p1"&gt;If Month = January THEN Current = Yes;&lt;/P&gt;
&lt;P class="p1"&gt;RUN&lt;/P&gt;
&lt;P class="p2"&gt;(30 points)&lt;/P&gt;
&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p2"&gt;Thank you for proving me an answer.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not the best worded question.&amp;nbsp; When confronted with poorly worded questions I like to include the assumptions that I have to make to remove the confusion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So &lt;STRONG&gt;assuming&lt;/STRONG&gt; that this was intended to be a complete step then I would &lt;STRONG&gt;assume&lt;/STRONG&gt; that they meant it to be a data step.&lt;/P&gt;
&lt;P&gt;So the first line should not have the equal sign.&lt;/P&gt;
&lt;P&gt;The second and last line should have ending semi-colons.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you correct those three mistakes then the code should run.&amp;nbsp; But it probably does not do what was intended.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the third line is valid code but the SUM() function is not needed because you are passing it only one value, the difference between the two variables DAILY and DAILY365.&amp;nbsp; So if we &lt;STRONG&gt;assume&lt;/STRONG&gt; that the intend was to sum multiple variables then perhaps the intend was to have a variable list instead of a subtraction.&amp;nbsp; In which case we need something like DAILY1-DAILY365.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The fourth line is also valid code, but perhaps not what was intended.&amp;nbsp; Right now it is comparing two variables, MONTH and JANUARY, and when they match it is replacing the value of CURRENT with the value of YES.&amp;nbsp; If we &lt;STRONG&gt;assume&lt;/STRONG&gt; what was wanted was to treat January and Yes as constant/literal strings instead of variable names then they need to be enclosed in quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For more analysis we would need to know if the libref FACTORY had been assigned and if the dataset PRODUCTION was in it. And what variables PRODUCTION contains. And information about how those variables were defined (type/length/format attached) and what they contained.&amp;nbsp; For example is MONTH a variable?&amp;nbsp; Is it character variable? A numeric variable?&amp;nbsp; If numeric does it have a date type format attached?&amp;nbsp; Or user defined format that makes the values look like January? Does the variable CURRENT already exist? Is it numeric or character?&amp;nbsp; Is it long enough to store the three bytes needed to store Yes?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Corrected code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data production;
  set factory.production;
  total = sum(of daily1-daily365);
  if month = 'January' then current = 'Yes';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Feb 2020 16:29:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623307#M183480</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-08T16:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: A simple final exam question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623635#M183636</link>
      <description>&lt;P&gt;Test it.&lt;/P&gt;
&lt;P&gt;With a data step like:&lt;/P&gt;
&lt;PRE&gt;data example;
   input x x1 x2 x3;
   total = sum(of x-x3);
datalines;
1 2 3 145678
;
run;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;72   data example;
73      input x x1 x2 x3;
74      total = sum(of x-x3);
                ---
                71
ERROR: Missing numeric suffix on a numbered variable list (x-x3).
ERROR 71-185: The SUM function call does not have enough arguments.

75   datalines;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set USER.EXAMPLE may be incomplete.  When this step was stopped there were 0
         observations and 5 variables.
WARNING: Data set USER.EXAMPLE was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

77   ;

&lt;/PRE&gt;
&lt;P&gt;Compare with:&lt;/P&gt;
&lt;PRE&gt;data example;
   input x x1 x2 x3;
   total = sum(of x -- x3);
   total2 = sum(of x1 - x3);
   total3 = sum(of x:);
datalines;
10 20 30 145
;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Feb 2020 17:21:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-simple-final-exam-question/m-p/623635#M183636</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-02-10T17:21:19Z</dc:date>
    </item>
  </channel>
</rss>

