0

I have a sas macro which is dependent on two varying variables Age and Year represented by &Age and &Year respectively.

I want to run the macro for each combination of the ages 15-18 and years 2007-2010 and wish to create an output table for each of these combinations (i.e. 16 tables in total).

Here is my problem, I try to give the output table the following name in the macro Matrix_pop_adm&Age_RP&Year which SAS doesn't like.

How can I name my output file correctly ?

Joe
  • 62,789
  • 6
  • 49
  • 67
user2568648
  • 3,001
  • 8
  • 35
  • 52
  • 2
    Protip: the best solution isn't having a dataset for each combination, it's using `BY` processing to run the process just once and have just one dataset with all sixteen combinations. – Joe Sep 18 '14 at 14:38

1 Answers1

5

As you're concatenating macro variables into a string with other delimiting characters, you need to add dots to make each distinct macro variable resolve (in this case) independently.

Matrix_pop_adm&Age._RP&Year 
/*                ^ force &AGE to resolve, instead of trying to resolve &Age_RP */
Chris J
  • 7,549
  • 2
  • 25
  • 25