Here is the exam data table that I would like to process here:
-origin data
| STU_ID | STU_KEY | STU_CODE |
|---|---|---|
| 123 | 2002123 | A120 |
| 124 | 2002124 | A120 |
| 125 | 2002125 | A120 |
| 126 | 2002126 | A120 |
| 127 | 2002127 | A120 |
| 128 | 2003123 | A120 |
| 129 | 2003124 | A120 |
| 130 | 2004123 | A120 |
| 131 | 2005123 | A120 |
| 132 | 2006123 | A120 |
| 133 | 2007123 | A120 |
| 134 | 2008321 | A120 |
I want to delete rows of specific key including between '2002' and '2006' using code of SAS proc sql.
-result data
| STU_ID | STU_KEY | STU_CODE |
|---|---|---|
| 133 | 2007123 | A120 |
| 134 | 2008321 | A120 |
'''error code'''
PROC SQL;
CREATE TABLE a.not_2002_2006 as
SELECT t.STU_ID,
t.STU_KEY,
t.STU_CODE
FROM a.stu as t
WHERE t.STU_KEY NOT LIKE '2002%'
and t.STU_KEY NOT LIKE '2003%'
and t.STU_KEY NOT LIKE '2004%'
and t.STU_KEY NOT LIKE '2005%'
and t.STU_KEY NOT LIKE '2006%'
GROUP BY t.STU_ID;
QUIT;
Let me know how to solve this problem.
