Hello - I am trying to solve for the following 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?
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;
Remove calculated from the code at line 51.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.