LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 4 Jan 2006 13:06:32 -0800
Reply-To:     David L Cassell <davidlcassell@MSN.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         David L Cassell <davidlcassell@MSN.COM>
Subject:      Re: listing macro vars in alpha order in %put _user_ statement?
In-Reply-To:  <200601042026.k04K1uJk010570@malibu.cc.uga.edu>
Content-Type: text/plain; format=flowed

depuy001@NOTES.DUKE.EDU wrote: >I'm looking for a way to reorder the listing of macro variables when I say >: %put _user_ ; >Alphabetical order would be ideal. I'm not sure exactly what order they >print in; it's not even quite in the order they were created. > >ie, here's a partial macro var list from the log (ANALYZE being the name >of the macro): > >ANALYZE E_Y_TRT_1 2386.728 >ANALYZE E_Y_TRT_2 2562.313 >ANALYZE SKEW_Y_S1_1 4.159 >ANALYZE E_Y_S1_2 1924.505 >ANALYZE SKEW_Y_S1_2 8.42 >ANALYZE LEV_S1_3 20 >ANALYZE SKEW_Y_S1_3 2.597 > >In this case, I'm looking at the mean and skewness of a variable (y) by >two categorical variables (trt w/ 2 levels, s1 w/ 3 levels). >It'd be easier if I could have it print these in alpha order. > >Any suggestions to help (besides using less macro vars, etc.)?

Instead of using %PUT, pull them out of the sashelp.macro table and sort them in PROC SQL before printing them out. You might want to encapsulate that in a function macro.

Of course, my *best* suggestions are all along the lines of "use fewer macros" and "put these in a data table instead of macros with names that are holding the metadata as well - that's bad data design". Sorry.

David -- David L. Cassell mathematical statistician Design Pathways 3115 NW Norwood Pl. Corvallis OR 97330

_________________________________________________________________ Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


Back to: Top of message | Previous page | Main SAS-L page