You can get this done with the CASE statement in the expression builder in the query builder. If you are using the query to pull a subset of the data, this has the advantage of creating the new column as it filters the data.
Create a calculated column, using an expression like this:
[pre]
CASE
WHEN (SOURCE.sub_market_code = 500 and SOURCE.market = "Test")
THEN "Test Group"
END
[/pre]
EG will generate the "as Name" suffix that creates a new column named Name or whatever you choose.
That works within the proc sql that EG generates.
If want a code approach and don't mind making another pass through the data, you could use a simple DATA step:
[pre]
data SOURCE;
set SOURCE;
length name $ 20;
if (DATA.sub_market_code = 500 and DATA.market = "Test") then
name="Test Group";
run;
[/pre]
Chris