0

New to SAS. I know the following codes are creating a macro variable that stores a list of variables names, but what do : and | mean?

%let v_lst = a b bb: t_v129 |
             c tt: t_v16 t_v275 |
             d: t_v56 |
        ;
andrey_sz
  • 751
  • 1
  • 13
  • 29
user3075021
  • 95
  • 1
  • 8

2 Answers2

3

The bar | has no fixed meaning. It is probably used as a delimiter. The macro variable is later split in subtrings delimited by |. This is often done using the %scan function and represents a way of list processing.

The colon indicates a prefix. bb: - all variables starting with bb. Many SAS PROC and the datastep can process variable lists this way.

Jetzler
  • 787
  • 3
  • 11
  • A single bar | means OR in SAS, so it may depend on usage. In this context it does appear to be a delimiter. – Reeza Jul 05 '16 at 22:01
1

You can put anything in macro variables, and what counts is what you do with it next. Now as a convention, the | symbol is conveniently used as a field/value separator, while the colon has no clear "conventional" use that I know of. Depending on the context, it could mean that values on its left (columns/variables) are to be associated to values to its right (other columns maybe). But you'd really need to look further down the code and look for loops using &v_lst, probably along with scan() or %scan() functions.

Jason V
  • 1,077
  • 7
  • 14