Hi:
Why did you take the %SCAN out of the code that Art posted for you??? Peter is probably right that you could solve this without using macro. However, if you REALLY are going to go down the macro road, it will be to your benefit to take a pause and LEARN what macro is all about, learn about how the %LET statement works and learn how the various macro functions work.
Otherwise, you are programming in the dark and no amount of advice from the forums can undo a broken program if you do not understand how SAS Macro programming and the SAS Macro variables work.
This paper is a good introduction:
http://www2.sas.com/proceedings/sugi28/056-28.pdf
In addition, there are MANY, MANY previous forum postings on the topic of macro programming (including my many curmudgeonly explanations on how to develop a macro program by starting with a WORKING non-macro-ized SAS program, such as this one from 2008
http://support.sas.com/forums/thread.jspa?messageID=15938㹂 ).
And, you can Google for the MANY user group papers and tutorials that have been presented on SAS Macro processing and which are publicly available in various conference proceedings. I would recommend that you stick with BEGINNER tutorials and get those under your belt before you move into the more advanced tutorials.
cynthia