{smcl} {* Mar2011}{...} {hline} help for {hi:mac_unab} {hline} {title:Unabbreviate Global Macro Lists} {p 4 8 2} {cmd:mac_unab} {it:mname} {bf: :} {it: patternlist} [ {cmd:,} {cmdab:i:gnore(}{it:string}{cmd:)} ] {break} {title:Description} {p 4 4 2} {cmd:mac_unab} mac_unab unabbreviates a global macro list. Similar to {help unab} it finds all macros (rather than variables) that exist and match a pattern and places them in a another global macro list. {title:Required} {p 4 8 2} {cmd: mname} is the name of the global macro created to contain all macros that match the {it: patternlist}. {p 4 8 2} {cmd: patternlist} describes the global macro list that should be unabbreviated. {it: patternlist} should consist of a {it: stub} followed by an asterisk (e.g., {it:gr*}) which will match global macros starting with the {it: stub} -- so {bf: gr*} would match already defined global macros {bf: gr{ul:een}} and {bf: gr{ul:own}}. {p 8 8 2} Currently, global macros can only be matched using the asterisk following the {it: stub} (e.g., {bf:gr*}), the asterisk cannot precede or split the {it: stub} (e.g., {bf: *gr} or {bf: gr*on}). {title:Options} {p 4 8 2} {cmdab:i:gnore()} allows a space delimited list of words that you want to remove from consideration when finding the macros in {it:patternlist} to unabbreviate. To ignore the macros S_ADO and S_level (but not other S_* macros, you could specify the option: {p 8 8 2} ... , {cmdab:i:gnore(}{it:S_ADO S_level}{cmd:)} {p 8 8 2} Similar to pattern matching in {help varlist}, {cmd:mac_unab} may match macros you didn't intend to be in the list; these can be removed using the {opt 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: {p 8 8 2} ... , {cmdab:i:gnore(}{it:SYSTEM}{cmd:)} {p 8 8 2} to ignore most or all of these macros. All macros can be listed with {help macro list} or {help macro dir}. Also, the resulting {bf: mname} can be further cleaned or manipulated using macro {help extended_fcn:extended functions}. {p 4 8 2} {it: `r(mac_list)'} also contains the unabbreviated macro list. {title:Remarks} {p 4 4 2} {cmd: mac_unab} produces the full {help macro list} output in the {bf: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 {help macro list} output. Further, this output cannot be surpressed by running {cmd: mac_unab} {help quietly} (doing so will produce an error). {title:Examples} //Create some data// {p 4 8 2}{cmd:. clear}{p_end} {p 4 8 2}{cmd:. set obs 10}{p_end} {p 4 8 2}{cmd:. g x = round(runiform()*100, .05)}{p_end} {p 4 8 2}{cmd:. g x2 = int(runiform()*100) }{p_end} {p 4 8 2}{cmd:. replace x = -2.5 in 1 }{p_end} //Convert Numbers to Text// {p 4 8 2}{cmd:. num2words x, g(x_converted) }{p_end} {p 4 8 2}{cmd:. num2words x, g(x_rounded) round }{p_end} {p 4 8 2}{cmd:. replace x_converted = proper(x_rounded) }{p_end} {p 4 8 2}{cmd:. num2words x, g(x2_ordinal) ordinal }{p_end} //Use Converted Text in Graph// {p 4 8 2}{cmd:. egen mx = mean(x) }{p_end} {p 4 8 2}{cmd:. num2words mx, round }{p_end} {p 4 8 2}{cmd:. gr bar x , over(x2_ordinal, sort(1)) /// }{p_end} {p 8 8 2}{cmd: note({bf: X for Obs 2 is `=x_rounded[2]'}) /// }{p_end} {p 8 8 2}{cmd: text(60 20 `"Mean = `=mx2'"', box ) }{p_end} {title:Author} {p 4 4 2}Eric A. Booth, Texas A&M University {break} ebooth@ppri.tamu.edu {break} {browse "http://www.eric-a-booth.com"} {title:Also see} {p 4 8 2}On-line: help for {help extended_fcn:macro extended functions}; {help unab:unab}