Hello @NRichmond (and welcome to the SAS Support Communities :-)),
The first part of the SELECT statement could be abbreviated by using a variable list in a KEEP= dataset option:
select * from work.dataset(keep=car1-car10);
or (under certain conditions)
select * from dataset(keep=car:);
I would also consider transposing (relevant parts of) work.dataset from wide to long (with a single variable car), which would allow for easy subsetting in PROC SQL like
having max(car in (&in_scope_cars));
after a suitable GROUP BY clause.
... View more