Hi, I have written a code where the address is mentioned in the table header with a # (dr_address##1)
. When I run the code, it shows an error. Could you please let me know what's wrong in my code? Thanks.
proc sql;
create table Customer_info as
select a.*,
b.dr_title,
b.dr_inits,
b.dr_name,
b.dr_address##1,
b.dr_address##2,
b.dr_address##3,
b.dr_address##4,
b.dr_postcode,
b.dr_phone,
b.dr_phone2,
b.dr_phone3,
b.dr_dob as Date_of_birth,
b.dr_email as email_address,
case when b.dr_phone is not null or
b.dr_phone2 is not null or
b.dr_phone3 is not null then 'Y' else 'N'
end as Number_available,
case when Email is not null then 'Y' else 'N'
end as Email_available
from Acc_level_plans as a
inner join p2scflow.debtor as b on a.debt_code=b.debt_code;
quit;
Error log
29 proc sql;
30 create table Customer_info as
31 select a.*,
32 b.dr_title,
33 b.dr_inits,
34 b.dr_name,
35 b.dr_address##1,
__
22
76
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, !, !!, &, *, **, +, ',', -, /, <, <=, <>, =, >, >=, ?,
AND, AS, BETWEEN, CONTAINS, EQ, EQT, FORMAT, FROM, GE, GET, GT, GTT, IN, INFORMAT, INTO, IS, LABEL, LE, LEN, LENGTH,
LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN, OR, TRANSCODE, ^, ^=, |, ||, ~, ~=.
ERROR 76-322: Syntax error, statement will be ignored.
36 b.dr_address##2,
37 b.dr_address##3,
38 b.dr_address##4,
39 b.dr_postcode,
40 b.dr_phone,
41 b.dr_phone2,
42 b.dr_phone3,
43 b.dr_dob as Date_of_birth,
44 b.dr_email as email_address,
2 The SAS System 09:04 Thursday, December 8, 2022
45 case when b.dr_phone is not null or
46 b.dr_phone2 is not null or
47 b.dr_phone3 is not null then 'Y' else 'N'
48 end as Number_available,
49 case when Email is not null then 'Y' else 'N'
50 end as Email_available
51 from Acc_level_plans as a
52 inner join p2scflow.debtor as b on a.debt_code=b.debt_code;
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
53 quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 324.21k
OS Memory 29528.00k
Timestamp 12/08/2022 10:57:39 AM
Step Count 68 Switch Count 0