Hi Bruce, Assuming you're using the second of my two pieces of code, you can generate two extra variables by adding in new case statements like so: PROC SQL; CREATE TABLE Your_New_Table AS SELECT *, CASE WHEN ToDate BETWEEN dmy(31,12,2009) AND dmy(31,12,2010) THEN old_performance_variable ELSE . END AS new_performance_variable, CASE WHEN ToDate BETWEEN dmy(31,12,2010) AND dmy(31,12,2011) THEN old_performance_variable ELSE . END AS new_performance_variable2, CASE WHEN ToDate BETWEEN dmy(31,12,2011) AND dmy(31,12,2012) THEN old_performance_variable ELSE . END AS new_performance_variable3 FROM your_original_table; QUIT; Note: There's no comma after new_performance_variable3, but there is after 1 and 2. Alternatively, if you want just one new variable, which includes information if any of those conditions are met and missing otherwise, you can extend out the original case clause like so: PROC SQL; CREATE TABLE Your_New_Table AS SELECT *, CASE WHEN ToDate BETWEEN dmy(31,12,2009) AND dmy(31,12,2010) THEN old_performance_variable WHEN ToDate BETWEEN dmy(31,12,2010) AND dmy(31,12,2011) THEN old_performance_variable WHEN ToDate BETWEEN dmy(31,12,2011) AND dmy(31,12,2012) THEN old_performance_variable ELSE . END AS new_performance_variable FROM your_original_table; QUIT; I'm off to bed for the night, but if you were using the other code framework i prepared instead, it would require some boolean logic (AND and OR clauses with some bracketing) in the where statement.
... View more