<?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: PROC SQL - UPDATE in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE/m-p/482514#M125007</link>
    <description>wow thank you</description>
    <pubDate>Mon, 30 Jul 2018 15:46:22 GMT</pubDate>
    <dc:creator>Abhau</dc:creator>
    <dc:date>2018-07-30T15:46:22Z</dc:date>
    <item>
      <title>PROC SQL - UPDATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE/m-p/482500#M124995</link>
      <description>&lt;P&gt;i'm confusing in this question , and how to subtract ?&lt;BR /&gt;please help me out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Run a single SQL program to update the values of variables. Add 5 more with weight if Type is Hamburger and subtract 100 from Calories.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jul 2018 15:21:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE/m-p/482500#M124995</guid>
      <dc:creator>Abhau</dc:creator>
      <dc:date>2018-07-30T15:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - UPDATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE/m-p/482503#M124998</link>
      <description>&lt;P&gt;Re: "subtract":&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your select expression, you need to reduce the value of the calories field by 100.&amp;nbsp;&amp;nbsp; I.e., you are being asked not only to list a bunch of fields from a table, but also to introduce a mathematical expression that would change the value of calories.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jul 2018 15:25:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE/m-p/482503#M124998</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-07-30T15:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - UPDATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE/m-p/482505#M124999</link>
      <description>This is my assignment , and this the question which i have , data sets i've by the name of junk food in that 8 variables , only the thing is , i've to update weight variable,as well as i've to subtract 100 from calories , in type variable Hamburger. please give some solution . sir</description>
      <pubDate>Mon, 30 Jul 2018 15:30:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE/m-p/482505#M124999</guid>
      <dc:creator>Abhau</dc:creator>
      <dc:date>2018-07-30T15:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - UPDATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE/m-p/482506#M125000</link>
      <description>yes exactly , please help me out</description>
      <pubDate>Mon, 30 Jul 2018 15:31:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE/m-p/482506#M125000</guid>
      <dc:creator>Abhau</dc:creator>
      <dc:date>2018-07-30T15:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - UPDATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE/m-p/482507#M125001</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/223450"&gt;@Abhau&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;i'm confusing in this question , and how to subtract ?&lt;BR /&gt;please help me out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run a single SQL program to update the values of variables. Add 5 more with weight if Type is Hamburger and subtract 100 from Calories.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What I normally do on a test where the question is written in a confusing way is make an assumption about what they mean and explain clearly what question I am actually going to answer and then answer the clarified question.&lt;/P&gt;
&lt;P&gt;So in this case if the question means:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Given a dataset name FOOD with character variable TYPE and numeric variables WEIGHT and CALORIES write a program using the SQL UPDATE statement that will for observations that have&amp;nbsp;TYPE equal to 'Hamburger'&amp;nbsp;change the value of WEIGHT to have 5 more (assuming that units are the same) and also update the value of CALORIES to have 100 less calories (assuming that values are already in calories).&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then an answer might look like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
update FOOD
  set weight=weight+5
    , calories=calories-100
  where type='Hamburger'
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Jul 2018 15:32:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE/m-p/482507#M125001</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-07-30T15:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - UPDATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE/m-p/482510#M125003</link>
      <description>&lt;P&gt;this is the error which i'm getting ,&amp;nbsp;&lt;BR /&gt;you gave me the code i used&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ERROR 73-322: Expecting an =.&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;64 , calories=calories-100&lt;BR /&gt;65 where type='Hamburger';&lt;BR /&gt;66 quit;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jul 2018 15:36:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE/m-p/482510#M125003</guid>
      <dc:creator>Abhau</dc:creator>
      <dc:date>2018-07-30T15:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - UPDATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE/m-p/482512#M125005</link>
      <description>&lt;P&gt;The code works for me. You didn't include enough of your SAS log for us to see what error you might have made.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data food;
  length type $20 weight calories 8;
  input type weight calories ;
cards;
Hamburger 20 500
Hamburger 24 600
Chips 5 1000
;

proc print data=food;
 title 'BEFORE';
run;

proc sql;
update FOOD
  set weight=weight+5
    , calories=calories-100
  where type='Hamburger'
;
quit;

proc print data=food;
 title 'AFTER';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;BEFORE  

Obs    type         weight    calories

 1     Hamburger      20         500
 2     Hamburger      24         600
 3     Chips           5        1000
&amp;#12;
AFTER

Obs    type         weight    calories

 1     Hamburger      25         400
 2     Hamburger      29         500
 3     Chips           5        1000&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Jul 2018 15:43:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE/m-p/482512#M125005</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-07-30T15:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - UPDATE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE/m-p/482514#M125007</link>
      <description>wow thank you</description>
      <pubDate>Mon, 30 Jul 2018 15:46:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-UPDATE/m-p/482514#M125007</guid>
      <dc:creator>Abhau</dc:creator>
      <dc:date>2018-07-30T15:46:22Z</dc:date>
    </item>
  </channel>
</rss>

