@Reeza wrote:
You're missing a space between the 0 and THEN, does the log indicate any issues with that?
I tested that and surprisingly enough SAS doesn't complain:
39 Proc sql;
40 create table junk as
41 select *,
42 case when age=13then 'A'
43 else 'B' end as group
44 from sashelp.class
45 ;
NOTE: Table WORK.JUNK created, with 19 rows and 6 columns.
46 quit;
Result is A for age 13 and B otherwise in the output data. So the code parser is a bit better than expected. Possibly because of the "variables can't start with digits" rules. However because the "then" starts with T the same isn't true with Character variables:
47 Proc sql;
48 create table junk as
49 select *,
50 case when name='Alfred'then 'A'
ERROR: Invalid date/time/datetime constant 'Alfred't.
50 case when name='Alfred'then 'A'
---
22
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, <, <=, <>,
=, >, >=, AND, EQ, EQT, GE, GET, GT, GTT, LE, LET, LT, LTT, NE, NET, NOT, OR, THEN,
^, ^=, |, ||, ~, ~=.
50 case when name='Alfred'then 'A'
---
202
ERROR 202-322: The option or parameter is not recognized and will be ignored.
51 else 'B' end as group
52 from sashelp.class
53 ;
54 quit