I am using SAS to loop through a list and perform multiple file move operations. I am performing the move within a data null. if have a in if/then/do when rc ne 0, then an else/do if it's successful. The move operation is working just fine. However, I want to pass error messages back to a macro variable so I can then use a proc sql ; update... to record the message that applies to the specific file where the move failed & then research the errors.
The move operation is working fine. However, I'm having trouble passing sysmsg() into a macro variable.
I've tried the following:
- symput/symputx("mvar",sysmsg())
- symput("mvar",%sysfunc(sysmsg())
- %let mvar=%sysfunc(sysmsg())
- msg = sysmsg() ; symput("mvar",msg)
None of them seems to be populating the variable with the desired sysmsg() text. what do I need to do?
Is the problem possibly inherent to the loop rather than the symput()/sysmsg() functionality?