08-27-2014 03:35 PM
I am looking for help regarding the use of macro variables.
I am a relatively inexperienced SAS programmer - having learned most of what I know by trial and error and modifying other peoples code!! I have a program that contains the following elements:
Currently, I use %LET statements to substitute for text in filenames, variable names, value names and output filenames, so that I only have to change them in three places (1 for each input file) instead of throughout the program.
However I have a number of combinations of these three files that I have to run –
I could run the program 3x6x34 times (612 !!), but I would like to set it up so that it defines the values for the %Let statements, something like the following…
2011, community1, chemical1, chemical2, chemical3….
2011, community2, chemical1, chemical2, chemical3….
2011, community3, chemical1, chemical2, chemical3…. ….and so on.
thereby running the program for each combination.
I have searched the SAS forum and other resources for something similar, but have yet to find a solution.
Any help would be much appreciated.
08-27-2014 04:14 PM
The general approach for automating tasks with the macro language is to have a working program for one case. Do you have that?
If so post the code and we can make suggestions for improvement.
Without seeing how the results of your let statements are used there is a bit of a hurdle to get over. It may well be if the variables are named as you are showing them that variable lists may be more helpful.
Also your statement about a "series of means and merges" makes one suspect that there may be ways to reduce the number of steps involved.