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?
Content-Type: text/plain; format=flowed
>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
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
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 L. Cassell
3115 NW Norwood Pl.
Corvallis OR 97330
Express yourself instantly with MSN Messenger! Download today - it's FREE!