<?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: Update statement error I don't understand in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969626#M376899</link>
    <description>I am sorry, I don't understand what you mean by this?&lt;BR /&gt;</description>
    <pubDate>Tue, 24 Jun 2025 20:04:37 GMT</pubDate>
    <dc:creator>noetsi</dc:creator>
    <dc:date>2025-06-24T20:04:37Z</dc:date>
    <item>
      <title>Update statement error I don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969575#M376878</link>
      <description>&lt;P&gt;Baffled why this error is occurring.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CREATE TABLE WORK.updatet1 AS
SELECT t1.TimeFrame ,
t1.'Counseling on Enrollment Opportu'n as CEO,
t1.'Instruction in Self Advocacy'n as ISA,
t1.'Job Exploration Counseling'n as JEC,
t1.'Work Based Learning Experience -'n as WBLE,
t1.'Workplace Readiness Training'n as WRT
FROM WORK.updatet t1;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
   CREATE TABLE WORK.revisedp1 AS 
   Select * from revisedp ;
   update WORK.revisedp1 as u
   set u.amount=(select CEO from updatet1 n where u.timeframe =n.timeframe)
   where u.rsaservicecategory = 'Counseling on Enrollment Opportu';
   quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I get&amp;nbsp;ERROR 73-322: Expecting an =. which I think is for invalid variable names, not sure why these are. I tried it in the original names and got the same error.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CREATE TABLE WORK.revisedp1 AS
Select * from revisedp ;
update WORK.revisedp1 as u
set u.amount=(select 'Counseling on Enrollment Opportu'n from updatet n where u.timeframe =n.timeframe)
where u.rsaservicecategory = 'Counseling on Enrollment Opportu';
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The table being updated has am amount by month(timeframe) for a series of categories. We are updating it with a table that looks like this (I can't show any of the results because it is state data and even aggregates can not be posted).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="noetsi_0-1750712541928.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107968i43034F519AE6A947/image-size/medium?v=v2&amp;amp;px=400" role="button" title="noetsi_0-1750712541928.png" alt="noetsi_0-1750712541928.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jun 2025 21:03:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969575#M376878</guid>
      <dc:creator>noetsi</dc:creator>
      <dc:date>2025-06-23T21:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: Update statement error I don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969579#M376879</link>
      <description>&lt;P&gt;Please provide the ENTIRE log for this PROC SQL. (We don't want 100s of lines before or after this PROC SQL, just the log for this PROC SQL)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please copy the log for this PROC SQL as text and paste it as text into the window that appears when you click on the &amp;lt;/&amp;gt; icon.&amp;nbsp;&lt;STRONG&gt;DO NOT SKIP THIS&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;STEP.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PaigeMiller_0-1699900743276.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/89703i797B759183DE7484/image-size/large?v=v2&amp;amp;px=999" role="button" title="PaigeMiller_0-1699900743276.png" alt="PaigeMiller_0-1699900743276.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jun 2025 22:33:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969579#M376879</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-06-23T22:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: Update statement error I don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969582#M376881</link>
      <description>&lt;P&gt;A couple of things I see you should check (but they shouldn't cause that error message).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In some places you use WORK.updatet1 and other places you use just&amp;nbsp;updatet1 .&amp;nbsp; Normally both should mean the same dataset , but if you have a USER libref (or another libref and have set to the USER= system option to that other libref) then they won't mean the same dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You reference the variable CEO without saying which of the two datsets referenced in the query it should come from.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you sure the value of the variable&amp;nbsp;&amp;nbsp;u.rsaservicecategory has the truncated string&amp;nbsp; 'Counseling on Enrollment Opportu' ?&amp;nbsp; But that shouldn't give an error, just incorrect results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;More likely because of having to type all of those name literals you have gotten your SAS session confused with unbalanced quotes.&lt;/STRONG&gt;&amp;nbsp; Try resetting the SAS session and running the code again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that you can use a simple RENAME statement or RENAME= dataset option to fix the variable names without having to make a separate dataset.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;...
FROM WORK.updatet
  (rename=(
  'Counseling on Enrollment Opportu'n = CEO
  'Instruction in Self Advocacy'n = ISA
  'Job Exploration Counseling'n = JEC
  'Work Based Learning Experience -'n = WBLE
  'Workplace Readiness Training'n = WRT
  ))
...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jun 2025 23:02:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969582#M376881</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-06-23T23:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: Update statement error I don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969610#M376893</link>
      <description>&lt;P&gt;I tried running it from scratch today and got the same error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what the log says:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;28         PROC SQL;
29            CREATE TABLE WORK.updatet1 AS
30            SELECT t1.TimeFrame ,
31                   t1.'Counseling on Enrollment Opportu'n as CEO,
32                   t1.'Instruction in Self Advocacy'n as ISA,
33                   t1.'Job Exploration Counseling'n as JEC,
34                   t1.'Work Based Learning Experience -'n as WBLE,
35                   t1.'Workplace Readiness Training'n as WRT
36               FROM WORK.updatet t1;
NOTE: Table WORK.UPDATET1 created, with 23 rows and 6 columns.

37         QUIT;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

38         
39         PROC SQL;
40            CREATE TABLE WORK.revisedp1 AS
41            Select * from revisedp ;
NOTE: Table WORK.REVISEDP1 created, with 656 rows and 3 columns.

42            update WORK.revisedp1 as u
43            set u.amount=(select CEO from updatet1 n where u.timeframe =n.timeframe)
                   _
                   73
                   76
ERROR 73-322: Expecting an =.

2                                                          The SAS System                               12:27 Tuesday, June 24, 2025

ERROR 76-322: Syntax error, statement will be ignored.

44            where u.rsaservicecategory = 'Counseling on Enrollment Opportu';
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
45            quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      
46         
47         
48         
49         


50         PROC SQL;
51            CREATE TABLE WORK.revisedp1 AS
52            Select * from revisedp ;
NOTE: Table WORK.REVISEDP1 created, with 656 rows and 3 columns.

53            update WORK.revisedp1 as u
54            set u.amount=(select 'Counseling on Enrollment Opportu'n from updatet n where u.timeframe =n.timeframe)
                   _
                   73
                   76
ERROR 73-322: Expecting an =.

ERROR 76-322: Syntax error, statement will be ignored.

55            where u.rsaservicecategory = 'Counseling on Enrollment Opportu';
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
56            quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Jun 2025 16:32:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969610#M376893</guid>
      <dc:creator>noetsi</dc:creator>
      <dc:date>2025-06-24T16:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Update statement error I don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969611#M376894</link>
      <description>Doing that now&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Jun 2025 16:41:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969611#M376894</guid>
      <dc:creator>noetsi</dc:creator>
      <dc:date>2025-06-24T16:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Update statement error I don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969625#M376898</link>
      <description>&lt;P&gt;Use a single-level name for the column, without a prefixed table name or alias.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jun 2025 19:54:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969625#M376898</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-06-24T19:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Update statement error I don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969626#M376899</link>
      <description>I am sorry, I don't understand what you mean by this?&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Jun 2025 20:04:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969626#M376899</guid>
      <dc:creator>noetsi</dc:creator>
      <dc:date>2025-06-24T20:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Update statement error I don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969627#M376900</link>
      <description>&lt;PRE&gt;43            set u.amount=(select CEO from updatet1 n where u.timeframe =n.timeframe)
                   _
                   73
                   76
ERROR 73-322: Expecting an =.&lt;/PRE&gt;
&lt;P&gt;Use amount, not u.amount&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jun 2025 20:49:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969627#M376900</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-06-24T20:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Update statement error I don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969630#M376902</link>
      <description>&lt;PRE&gt;u.amount&lt;/PRE&gt;
&lt;P&gt;Two-level name&lt;/P&gt;
&lt;PRE&gt;amount&lt;/PRE&gt;
&lt;P&gt;Single-level name, just like&lt;/P&gt;
&lt;PRE&gt;u&lt;/PRE&gt;
&lt;P&gt;would be, and that's why the dot is indicated as the location of the ERROR&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jun 2025 20:54:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969630#M376902</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-06-24T20:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: Update statement error I don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969638#M376903</link>
      <description>Thank you very much.&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Jun 2025 22:15:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969638#M376903</guid>
      <dc:creator>noetsi</dc:creator>
      <dc:date>2025-06-24T22:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: Update statement error I don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969640#M376904</link>
      <description>That worked thank you very much. I am entirely baffled why this matters, but it removed the problem. Thanks again.&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Jun 2025 22:48:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969640#M376904</guid>
      <dc:creator>noetsi</dc:creator>
      <dc:date>2025-06-24T22:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Update statement error I don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969642#M376905</link>
      <description>In the SET clause of the UPDATE statement, only variables of the dataset named in UPDATE can be set, so no identification of a specific table is needed and therefore not recognized by the SQL compiler.</description>
      <pubDate>Tue, 24 Jun 2025 22:54:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969642#M376905</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-06-24T22:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: Update statement error I don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969678#M376916</link>
      <description>Thanks I appreciate your explanation. I usually use SAS for statistics and do SQL in the microsoft server which is the primary place our system was set up to access our data. There are some nice features of SAS sql so I am learning it more, but update's are one of the places these two platforms vary significantly differently.   Thank you a lot for your help.&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Jun 2025 15:45:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969678#M376916</guid>
      <dc:creator>noetsi</dc:creator>
      <dc:date>2025-06-25T15:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Update statement error I don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969746#M376933</link>
      <description>&lt;P&gt;I have rarely found the UPDATE statement of PROC SQL very useful for data analysis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I always suspected that is something that DATABASE builders might find useful.&amp;nbsp; But for building analysis datasets normal data steps and/or SQL joins is usually the simplest thing to use.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jun 2025 21:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969746#M376933</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-06-25T21:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Update statement error I don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969821#M376952</link>
      <description>We had a problem in that spending in one category had to be assigned to other categories on what was essentially a best guess approach. So I built excel tables with our best estimate of what the change was and then we used these to update the original. I am sure there were other ways to do this in SAS (in general I have found there are nearly always more than one way to do something in SAS). &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Thanks again for the help.&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Jun 2025 21:03:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969821#M376952</guid>
      <dc:creator>noetsi</dc:creator>
      <dc:date>2025-06-26T21:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Update statement error I don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969823#M376954</link>
      <description>&lt;P&gt;Normally in that case you would use MERGE statement in a data step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data fixed;
  merge  original updates;
  by key vars ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Although you might want to use the orignal UPDATE statement (that has nothing to do with the SQL statement with the same name).&amp;nbsp; That is designed to apply transactions.&amp;nbsp; That way you only need to enter the values that change in the transaction dateset since with UPDATE missing values do not replace the original value.&amp;nbsp; So you only need to enter the values that need to change.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jun 2025 01:20:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-statement-error-I-don-t-understand/m-p/969823#M376954</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-06-27T01:20:44Z</dc:date>
    </item>
  </channel>
</rss>

