FW: A MACRO HELP NEEDED - I am new in Macro (please help me)

FW: A MACRO HELP NEEDED - I am new in Macro (please help me)

Post by NordlD » Wed, 21 May 2008 06:08:19


> -----Original Message-----

Tom

When beginning to learn macro it is important to keep in mind two concepts (among others):
1. macro and data step code are run at different times.
2. macro processing is text substitution (over-simplified but essentially true).

It looks like you might be inappropriately mixing macro and data step code. At the very least your choice of macro parameter names may be confusing.

If you want to include the macro generated statements more than once in a program then just include the macro call more than once

Data want;
set have;
...
%select(v1,v2)
... More statements
%select(v3,v4)
...
Run;

But as Ron Fehd has pointed out, macro may not be the tool that you want to use to solve your problem. Why are you using macro code at all here. What is the problem that macro is supposed to solve for you that you can't use plain old data step code for?

If you tell us more about what you are trying to accomplish, someone may be able to give you better advice.

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204