For in loop equivalent in SAS 9.3?
I'm searching for a while an equivalent of the ***for in* loop** (like in [Python] or in R) in SAS 9.3 macro language. The [DO loop] seem's to be the solution but did't work exactly as I want. I founded a way to do it in a data step with a *DO loop* but it don't work with the macro language. For example, in a data step, this code is working : DATA _NULL_; DO i = 1,3,5,9; PUT i; END; RUN; And then the log prompt as expected : 1 3 5 9 When I try to do the same with an *%DO* loop in a Macro, I have an error. %MACRO test(); %DO i = 1,2,4,9 ; %PUT i = &i; %END; %MEND; %test(); The log promp these messages : ERROR: Expected %TO not found in %DO statement. ERROR: A dummy macro will be compiled I'm quite new in SAS and stackoverflow so I hope my question is no too stupid. It's so simple to do this in Python and R then it must have a simple way to do it in SAS. Thank's for help - J. Muller : http://docs.python.org/2/tutorial/controlflow.html#for-statements : http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000201276.htm