You could "macro-ize" something like the program example below. It is always best, however to start with a basic non-macro program and understand how it works before you convert it to a macro program.
if prdsale=1 then filename = 'SASHELP.PRDSALE';
else if prdsal2 = 1 then filename = 'SASHELP.PRDSAL2';
else if prdsal3 = 1 then filename = 'SASHELP.PRDSAL3';