This is easy in a data step.
You want to put an output statement into a loop where invoice=32, then 33, then 34, then 35. But after the first output, you want to set amount to a missing value. So the real issue is how to make a loop over the character variable INVOICELIST (="32,33,34,35"). This program does that:
Notes:
Use the COUNTW function to find the number of "words" in invoicelist (where a word in this case is delimited by commas).
Use the SCAN functino to retrieve those words in succession.
data have;
attrib date format=mmddyys10.
amount length=8
invoicelist length=$20;
input date mmddyy10. amount invoicelist;
datalines;
10/31/2016 3200 32,33,34,35
run;
data want;
set have;
do I=1 to countw(invoicelist,',');
invoice=input(scan(invoicelist,I,','),4.);
output;
amount=.;
end;
drop invoicelist;
run;
... View more