Hey. Let's consider the table 'Cars' and table 'Dictionary'. Table dictionary has two variables, first: ID of a row, second: condition which determines what ID has a particular row. For instance, where a record: Type='SUV' and Horsepower > 300 and Cylinders > 6 THEN ID=TYPE_A Now, using var_condition and var_id I would like to flag every record of a dataset by an 'ID' and stack them in a new table. I tried simple macro %if &var_condition then new_column = &ID, but I am not even close. How can I approach this task? data cars;
set sashelp.cars;
run;
data Dictionary;
input ID : $6. Condition & $211.;
datalines;
TYPE_A upcase(Type) IN('SUV', 'SPORTS', 'WAGON') and upcase(Origin) = 'ASIA' AND Horsepower > 150
TYPE_B Horsepower >= 220 and upcase(Origin)='EUROPE'
TYPE_C Type='SUV' and Horsepower > 300 and Cylinders > 6
;
proc sql noprint;
select ID into :var_id seprated by ' '
from Dictionary;
proc sql noprint;
select Condition into :var_condition seprated by ' '
from Dictionary;
... View more