I want to make a new column based on another column I don't want to make a new table; rather, I want my query to produce the desired output.

I have a query that produces a bunch of columns, and then a PROGRAM_ID column which only has 666 or 667. I want to make a select on top of this select that makes a new column, PATTERN, that has a 0 if the PROGRAM_ID is 666 and a 1 if it's 667. I know I need to use cases but I'm unsure of the syntax.
Use DECODE:

SELECT ID, PROGRAM_ID, DECODE(PROGRAM_ID, 666, 0, 667, 1, PROGRAM_ID)     AS PATTERN
FROM (                
  SELECT ID, PROGRAM_ID
  FROM YOURTABLE
);


Documentation link to DECODE().

Using CASE, alternatively:

SELECT ID, PROGRAM_ID, 
       CASE PROGRAM_ID WHEN 666 THEN 0
                       WHEN 667 THEN 1
                       ELSE PROGRAM_ID
       END AS PATTERN
FROM (                
  SELECT ID, PROGRAM_ID
  FROM YOURTABLE
);


Example SQL Fiddle here.