SAS MACROS and DO LOOPS (Part 2): SAS for Beginners (Lesson 30)

This is part 2 to learn those tough SAS macros! We take it up a notch by using %Do Loop Macros in order to store a variable list as a macro, label variables, and run procedures across multiple data sets at once! Do loops can be hard to understand; however, this video breaks it down fairly simply so you don't have to run away from the loops! Remember macro programs start with a %MACRO statement and end with a %MEND. The %DO loop macro goes in between those two statements and start with a %DO, %TO, and %END! If you remember this you will be good to go! Here is some of the code from the video. This is the dataset used first in the video (just copy and paste): data test; input DEMOG1 DEMOG2 $ DEMOG3 $ Purchase_Amt Purchase_Cat $; datalines; 32 Ben M 47.56 Food 44 Ann F 32.10 Fitness 21 Joe M 72.44 Pet ; run; Here is the second tutorial datasets on Purchase Amount: data Purchase1; input id amount; datalines; 1 43.55 2 62.88 3 52.43 ; run; data Purchase2; input id amount; datalines; 1 32.11 2 93.12 3 54.16 4 89.99 ; run; data Purchase3; input id amount; datalines; 1 15.31 2 102.15 ; run; If you missed Part 1 here you go:    • SAS MACROS (Part 1):  SAS for Beginners (L...   Please like, comment, and subscribe :) #sas #sasmacros #doloops