Hi...I can't seem to correct why I am receiving an error message.....I am wondering if anyone can see where the error is. Thanks.
%LET StartDate = '2013-01-01 00:00:00.000';
%LET EndDate = '2017-12-31 23:59:59.999';
proc sql noprint;
create table new as
SELECT DISTINCT
S.StudentID,
S.LastName,
S.FirstName,
SP.MajorDegree,
SS.RegisterStatus,
S.DateEntered AS 'Matriculation Date'n,
S.WithdrawnDate,
(SELECT AdmissionDate FROM SQLDB.StudentDegree
WHERE (StudentUID = S.StudentUID
AND MajorID1 = SP.MajorDegreeID)
ORDER BY GraduationDate DESC) AS AdmissionDate,
(SELECT GraduationDate FROM SQLDB.StudentDegree
WHERE (StudentUID = S.StudentUID
AND MajorID1 = SP.MajorDegreeID)
ORDER BY GraduationDate DESC) AS GraduationDate,
SS.EnrollmentStatus
FROM SQLDB.CAMS_StudentStatus_View SS
INNER JOIN SQLDB.CAMS_Student_View S ON S.StudentUID = SS.StudentUID
INNER JOIN SQLDB.CAMS_StudentProgram_View SP ON SP.StudentStatusID = SS.StudentStatusID
INNER JOIN SQLDB.Programs PG ON S.ProgramsID = PG.ProgramsID
WHERE S.DateEntered BETWEEN &StartDate AND &EndDate
AND SP.MajorDegree ^= ''
ORDER BY S.DateEntered, S.StudentID ASC;
quit;
Log output:
8 GOPTIONS ACCESSIBLE;
39
40 %LET StartDate = '2013-01-01 00:00:00.000';
41 %LET EndDate = '2017-12-31 23:59:59.999';
42
43
44 proc sql noprint;
45 create table new as
46 SELECT DISTINCT
47 S.StudentID,
48 S.LastName,
49 S.FirstName,
50 SP.MajorDegree,
51 SS.RegisterStatus,
52 S.DateEntered AS 'Matriculation Date'n,
53 S.WithdrawnDate,
54 (SELECT AdmissionDate FROM SQLDB.StudentDegree
2 The SAS System 12:53 Thursday, October 5, 2017
55 WHERE (StudentUID = S.StudentUID
56 AND MajorID1 = SP.MajorDegreeID)
57 ORDER BY GraduationDate DESC) AS AdmissionDate,
_____
22
76
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, ), *, **, +, -, /, <, <=, <>, =, >, >=, ?, AND, BETWEEN,
CONTAINS, EQ, EQT, EXCEPT, GE, GET, GROUP, GT, GTT, HAVING, IN, INTERSECT, IS, LE, LET, LIKE, LT, LTT, NE, NET, NOT,
NOTIN, OR, OUTER, UNION, ^, ^=, |, ||, ~, ~=.
ERROR 76-322: Syntax error, statement will be ignored.
58 (SELECT GraduationDate FROM SQLDB.StudentDegree
59 WHERE (StudentUID = S.StudentUID
60 AND MajorID1 = SP.MajorDegreeID)
61 ORDER BY GraduationDate DESC) AS GraduationDate,
62 SS.EnrollmentStatus
63 FROM SQLDB.CAMS_StudentStatus_View SS
64 INNER JOIN SQLDB.CAMS_Student_View S ON S.StudentUID = SS.StudentUID
65 INNER JOIN SQLDB.CAMS_StudentProgram_View SP ON SP.StudentStatusID = SS.StudentStatusID
66 INNER JOIN SQLDB.Programs PG ON S.ProgramsID = PG.ProgramsID
67 WHERE S.DateEntered BETWEEN &StartDate AND &EndDate
68 AND SP.MajorDegree ^= ''
69 ORDER BY S.DateEntered, S.StudentID ASC;
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
70 quit;
Hi.....
... View more