## DATA Step, Macro, Functions and more

Solved
Frequent Contributor
Posts: 104

44
45           PROC SQL;
46             CREATE TABLE ENROLL2 AS
47               A.*,
_
_
_
22
22
22
_
_
_
200

200
200
ERROR 22-322: SYNTAX ERROR, EXPECTING ONE OF THE FOLLOWING: (, SELECT.
ERROR 22-322: SYNTAX ERROR, EXPECTING ONE OF THE FOLLOWING: (, SELECT.
ERROR 22-322: SYNTAX ERROR, EXPECTING ONE OF THE FOLLOWING: (, SELECT.

ERROR 200-322: THE SYMBOL IS NOT RECOGNIZED AND WILL BE IGNORED.
ERROR 200-322: THE SYMBOL IS NOT RECOGNIZED AND WILL BE IGNORED.
ERROR 200-322: THE SYMBOL IS NOT RECOGNIZED AND WILL BE IGNORED.

48               B.BENESSN,
49               B.EDIPN,
50               CASE
51                 WHEN TRIM(A.NAME3) NE TRIM(B.NAME3)
52                       THEN B.FIRSTNAME !! " " !! B.LASTNAME
53                 END AS NAMEMISMATCH
54             FROM
55               BENE2B AS A LEFT JOIN ENROLL3 AS B
57                      AND A.PATIENTDOB = B.PATIENTDOB);
NOTE: PROC SQL SET OPTION NOEXEC AND WILL CONTINUE TO CHECK THE SYNTAX OF STATEM
58           QUIT;
NOTE: THE SAS SYSTEM STOPPED PROCESSING THIS STEP BECAUSE OF ERRORS.
NOTE: THE PROCEDURE SQL USED 0.00 CPU SECONDS AND 15462K.

NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 2640K BELOW THE LINE AND 309780K A

59

60           PROC SQL;
61             CREATE TABLE ENROLL2 AS
62               A.*,
_
_
_
22
22
22
_
_
_
200
200
200
ERROR 22-322: SYNTAX ERROR, EXPECTING ONE OF THE FOLLOWING: (, SELECT.
ERROR 22-322: SYNTAX ERROR, EXPECTING ONE OF THE FOLLOWING: (, SELECT.
ERROR 22-322: SYNTAX ERROR, EXPECTING ONE OF THE FOLLOWING: (, SELECT.

ERROR 200-322: THE SYMBOL IS NOT RECOGNIZED AND WILL BE IGNORED.
ERROR 200-322: THE SYMBOL IS NOT RECOGNIZED AND WILL BE IGNORED.
ERROR 200-322: THE SYMBOL IS NOT RECOGNIZED AND WILL BE IGNORED.

63               B.BENESSN,
64               B.EDIPN,
65               CASE

66                 WHEN TRIM(A.NAME3) NE TRIM(B.NAME3)
67                       THEN B.FIRSTNAME !! " " !! B.LASTNAME
68                 END AS NAMEMISMATCH
69             FROM
70               BENE2B AS A LEFT JOIN ENROLL3 AS B
72                      AND A.PATIENTDOB = B.PATIENTDOB);
NOTE: PROC SQL SET OPTION NOEXEC AND WILL CONTINUE TO CHECK THE SYNTAX OF STATEM
73           QUIT;
NOTE: THE SAS SYSTEM STOPPED PROCESSING THIS STEP BECAUSE OF ERRORS.
NOTE: THE PROCEDURE SQL USED 0.00 CPU SECONDS AND 15462K.

NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 2640K BELOW THE LINE AND 309780K A

74
75

76           PROC PRINT DATA=ENROLL2 (OBS=200); TITLE 'ENROLL2'; RUN;

NOTE: THERE WERE 200 OBSERVATIONS READ FROM THE DATA SET WORK.ENROLL2.
NOTE: THE PROCEDURE PRINT PRINTED PAGE 2.
NOTE: THE PROCEDURE PRINT USED 0.00 CPU SECONDS AND 18662K.

NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 2640K BELOW THE LINE AND 309780K A

77

Accepted Solutions
Solution
‎10-09-2017 11:48 AM
Super Contributor
Posts: 331

Hello,

The log indicates the problem. You forgot the SELECT keyword : CREATE TABLE XXX AS SELECT A.*,....

All Replies
Solution
‎10-09-2017 11:48 AM
Super Contributor
Posts: 331

Hello,

The log indicates the problem. You forgot the SELECT keyword : CREATE TABLE XXX AS SELECT A.*,....
PROC Star
Posts: 1,215

You are missing a select clause at line 62

Super User
Posts: 9,919

As it says, next should come a select statement. Consult the proc sql documentation.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
☑ This topic is solved.