LHV, It's possible to add a few more variables to a single format. But you have to watch the details. Here's how you would begin. data create_format; set dataset1 (keep=lot_id unit_id plus a few more); retain fmtname '$lot'; rename unit_id=start; length label $ 200; label = unit_id; substr(label, 31) = plus; substr(label, 51) = a; substr(label, 71) = few; substr(label, 91) = more; keep start label fmtname; run; The idea is to pack additional information into the format, in known positions. If you are adding numeric pieces, you should convert them to character using the PUT function. Once that is done, you need PROC SUMMARY to use only the beginning of the formatted value, not the whole string that includes the added information. So, run PROC FORMAT as before, and then: proc summary data=dataset2 NWAY; var value; class unit_id; format unit_id $lots20.; output out=totals (keep=unit_id value) sum=; run; In this step, the only difference is specifying $LOTS20., which tells SAS how many characters of the $LOTS format to apply. Then in the DATA step, get all the related information: data totals; set totals; length long_string $200 lot_id plus a few more $ 20; long_string = put(unit_id, $lots200.); lot_id = substr(long_string, 1, 20); plus = substr(long_string, 31, 20); a = substr(long_string, 51, 20); few = substr(long_string, 71, 20); more = substr(long_string, 91, 20); drop long_string unit_id; run; Of course, you have to adjust the length you assign to each variable, depending on what is actually needed. I suspect that this will be MUCH faster than anything that has to join the data sets, but you have to use tools that you feel comfortable with. Good luck.
... View more