Dear all, I'm very new to the loops and macro, I've been searching for the answers all day but couldn't do it right in SAS. I want to break down my variables into different parts and make them into new variable, say the variable is people's name or address, and can have space and comma among the words. This what I did for example: 1. How can I use a loop to do it? any macro needed? or is there any other simple way? data APPLE; set TEST; NEW1 = scan (NAME1, 1); NEW2 = scan (NAME1, 2); NEW3 = scan (NAME1, 3); ... NEWn = scan (NAME1, n) run; 2. If I have another variable, for example NAME2, can it be done with loop as well? data APPLE; set TEST; NEW1 = scan (NAME1, 1); NEW2 = scan (NAME1, 2); NEW3 = scan (NAME1, 3); ... NEWn = scan (NAME1, n) NEW(n+1) = scan (NAME2, 1); NEW(n+2) = scan (NAME2, 2); ... NEW(n+m) = scan (NAME2, m); run; Thank you so much for the help!
... View more