-------------------------------------------------------------------------------
help for mac_unab
-------------------------------------------------------------------------------

Unabbreviate Global Macro Lists

mac_unab mname : patternlist [ , ignore(string) ]

Description

mac_unab mac_unab unabbreviates a global macro list. Similar to unab it finds all macros (rather than variables) that exist and match a pattern and places them in a another global macro list.

Required

mname is the name of the global macro created to contain all macros that match the patternlist.

patternlist describes the global macro list that should be unabbreviated. patternlist should consist of a stub followed by an asterisk (e.g., gr*) which will match global macros starting with the stub -- so gr* would match already defined global macros green and grown.

Currently, global macros can only be matched using the asterisk following the stub (e.g., gr*), the asterisk cannot precede or split the stub (e.g., *gr or gr*on).

Options

ignore() allows a space delimited list of words that you want to remove from consideration when finding the macros in patternlist to unabbreviate. To ignore the macros S_ADO and S_level (but not other S_* macros, you could specify the option:

... , ignore(S_ADO S_level)

Similar to pattern matching in varlist, mac_unab may match macros you didn't intend to be in the list; these can be removed using the ignore option. This can be particularly tricky with expanding a macro list because there are global macros created by the software or other commands you may have run. In order to ignore some or most of these types of macros (usually begining in a S_, F, or _) you can call the option:

... , ignore(SYSTEM)

to ignore most or all of these macros. All macros can be listed with macro list or macro dir. Also, the resulting mname can be further cleaned or manipulated using macro extended functions.

`r(mac_list)' also contains the unabbreviated macro list.

Remarks

mac_unab produces the full macro list output in the Results window when run. Currently, this output cannot be surpressed. The reason for this is that the expanded macro list is culled from a log file of macro list output. Further, this output cannot be surpressed by running mac_unab quietly (doing so will produce an error).

Examples

//Create some data// . clear . set obs 10 . g x = round(runiform()*100, .05) . g x2 = int(runiform()*100) . replace x = -2.5 in 1

//Convert Numbers to Text// . num2words x, g(x_converted) . num2words x, g(x_rounded) round . replace x_converted = proper(x_rounded) . num2words x, g(x2_ordinal) ordinal

//Use Converted Text in Graph// . egen mx = mean(x) . num2words mx, round . gr bar x , over(x2_ordinal, sort(1)) /// note( X for Obs 2 is `=x_rounded[2]') /// text(60 20 `"Mean = `=mx2'"', box )

Author

Eric A. Booth, Texas A&M University ebooth@ppri.tamu.edu http://www.eric-a-booth.com

Also see

On-line: help for macro extended functions; unab