<?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 proc sql Calculate difference between variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-Calculate-difference-between-variables/m-p/811089#M319917</link>
    <description>&lt;P&gt;Hello - I am trying to solve for the following&amp;nbsp;ERROR 22-322: Expecting a name. The log is below. I am trying to creating a table to calculate the difference of a report week over week. I have tried formating the calculated rows several different ways and keep getting this error. Does anyone see anything that is an issue in my code that could be causing this?&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;35         proc sql;
35       !           create table WeekoverWeek as
36         select distinct
37         a.AHIPNeeded as AHIPNeeded1,
38         b.AHIPNeeded as AHIPNeeded2,
39         a.ReadyToTrain as ReadyToTrain1,
40         b.ReadyToTrain as ReadyToTrain2,
41         a.ReadyToSell as ReadyToSell1,
42         b.ReadyToSell as ReadyToSell2,
43         a.TotalContracted as TotalContracted1,
44         b.TotalContracted as TotalContracted2,
45         a.'2022 Sales Goal'n as '2022 Sales Goal1'n,
46         b.'2022 Sales Goal'n as '2022 Sales Goal2'n,
47         a.'2022 Sales'n as '2022 Sales1'n,
48         b.'2022 Sales'n as '2022 Sales2'n,
49         a.Avg_Apps_RTS as Avg_Apps_RTS1,
50         b.Avg_Apps_RTS as Avg_Apps_RTS2,
51         calculated (b.AHIPNeeded2 - a.AHIPNeeded1) as DIF_AHIPNeeded,
                      _
2                                                          The SAS System                                  09:10 Monday, May 2, 2022

                      22
                      76
ERROR 22-322: Expecting a name.  

ERROR 76-322: Syntax error, statement will be ignored.

52         calculated(b.ReadyToTrain2 - a.ReadyToTrain1) as DIF_ReadyToTrain,
53         calculated(b.ReadyToSell2 - a.ReadyToSell1) as DIF_ReadyToSell,
54         calculated(b.TotalContracted2 - a.TotalContracted1) as DIF_TotalContracted,
55         calculated(b.'2022 Sales Goal2'n - a.'2022 Sales Goal1'n) as 'DIF_2022 Sales Goal'n,
56         calculated(b.'2022 Sales2'n, - a.'2022 Sales1'n) as 'DIF_2022 Sales'n,
57         calculated(b.Avg_Apps_RTS2 - a.Avg_Apps_RTS1) as DIF_Avg_Apps_RTS
58         From BrokerFinal a
59         left join so_share.BrokerFinal_Archive b
60         on a.ASSIGNED_BROKER_MANAGER=b.ASSIGNED_BROKER_MANAGER
61         ;
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
62         quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 02 May 2022 16:10:28 GMT</pubDate>
    <dc:creator>LMSSAS</dc:creator>
    <dc:date>2022-05-02T16:10:28Z</dc:date>
    <item>
      <title>proc sql Calculate difference between variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-Calculate-difference-between-variables/m-p/811089#M319917</link>
      <description>&lt;P&gt;Hello - I am trying to solve for the following&amp;nbsp;ERROR 22-322: Expecting a name. The log is below. I am trying to creating a table to calculate the difference of a report week over week. I have tried formating the calculated rows several different ways and keep getting this error. Does anyone see anything that is an issue in my code that could be causing this?&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;35         proc sql;
35       !           create table WeekoverWeek as
36         select distinct
37         a.AHIPNeeded as AHIPNeeded1,
38         b.AHIPNeeded as AHIPNeeded2,
39         a.ReadyToTrain as ReadyToTrain1,
40         b.ReadyToTrain as ReadyToTrain2,
41         a.ReadyToSell as ReadyToSell1,
42         b.ReadyToSell as ReadyToSell2,
43         a.TotalContracted as TotalContracted1,
44         b.TotalContracted as TotalContracted2,
45         a.'2022 Sales Goal'n as '2022 Sales Goal1'n,
46         b.'2022 Sales Goal'n as '2022 Sales Goal2'n,
47         a.'2022 Sales'n as '2022 Sales1'n,
48         b.'2022 Sales'n as '2022 Sales2'n,
49         a.Avg_Apps_RTS as Avg_Apps_RTS1,
50         b.Avg_Apps_RTS as Avg_Apps_RTS2,
51         calculated (b.AHIPNeeded2 - a.AHIPNeeded1) as DIF_AHIPNeeded,
                      _
2                                                          The SAS System                                  09:10 Monday, May 2, 2022

                      22
                      76
ERROR 22-322: Expecting a name.  

ERROR 76-322: Syntax error, statement will be ignored.

52         calculated(b.ReadyToTrain2 - a.ReadyToTrain1) as DIF_ReadyToTrain,
53         calculated(b.ReadyToSell2 - a.ReadyToSell1) as DIF_ReadyToSell,
54         calculated(b.TotalContracted2 - a.TotalContracted1) as DIF_TotalContracted,
55         calculated(b.'2022 Sales Goal2'n - a.'2022 Sales Goal1'n) as 'DIF_2022 Sales Goal'n,
56         calculated(b.'2022 Sales2'n, - a.'2022 Sales1'n) as 'DIF_2022 Sales'n,
57         calculated(b.Avg_Apps_RTS2 - a.Avg_Apps_RTS1) as DIF_Avg_Apps_RTS
58         From BrokerFinal a
59         left join so_share.BrokerFinal_Archive b
60         on a.ASSIGNED_BROKER_MANAGER=b.ASSIGNED_BROKER_MANAGER
61         ;
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
62         quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 May 2022 16:10:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-Calculate-difference-between-variables/m-p/811089#M319917</guid>
      <dc:creator>LMSSAS</dc:creator>
      <dc:date>2022-05-02T16:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql Calculate difference between variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-Calculate-difference-between-variables/m-p/811091#M319919</link>
      <description>&lt;P&gt;Remove &lt;FONT face="courier new,courier"&gt;calculated&lt;/FONT&gt; from the code at line 51.&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 16:26:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-Calculate-difference-between-variables/m-p/811091#M319919</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-05-02T16:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql Calculate difference between variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-Calculate-difference-between-variables/m-p/811092#M319920</link>
      <description>Yes, that worked, Thank you!!</description>
      <pubDate>Mon, 02 May 2022 16:31:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-Calculate-difference-between-variables/m-p/811092#M319920</guid>
      <dc:creator>LMSSAS</dc:creator>
      <dc:date>2022-05-02T16:31:00Z</dc:date>
    </item>
  </channel>
</rss>

