I am trying to add a new column to a dataset based on the binary condition of another column. However, I keep getting an error. My code below:
proc sql;
alter table data
add Status (case WHEN missing(DeactReason) THEN 'Active' ELSE 'Inactive)'
END;
quit;
However, I get the following error:
143 proc sql;
144 alter table data
145 add Status (case WHEN missing(DeactReason) THEN 'Active' ELSE 'Inactive)'
-
79
ERROR 79-322: Expecting a CHECK.
146 END;
-
79
ERROR 79-322: Expecting a ).
147 quit;
Thanks! EDIT: Corrected the code:
proc sql;
alter table table
add Status (case WHEN missing(DeactReason) THEN 'Active' ELSE 'Inactive')
END;
quit;
Get the following error now:
148 proc sql;
149 alter table table
150 add Status (case WHEN missing(DeactReason) THEN 'Active' ELSE 'Inactive')
- -
79 22
76
ERROR 79-322: Expecting a CHECK.
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, <, <=,
<>, =, >, >=, ?, AND, BETWEEN, CONTAINS, END, EQ, EQT, GE, GET, GT, GTT, IN, IS,
LE, LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN, OR, ^, ^=, |, ||, ~, ~=.
ERROR 76-322: Syntax error, statement will be ignored.
151 END;
152 quit;