Date: Sun, 10 Nov 2002 22:58:51 GMT
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Roger Lustig <trovato@BELLATLANTIC.NET>
Subject: Re: A quick question.
Content-Type: text/plain; charset=us-ascii; format=flowed
The easiest thing might be to rebuild the data set using the current order.
data rebuilt (drop=month count);
array m_ (200210:200212) m_200210 - m_200212;
do until (last.type2_desc);
by type1_desc type2_desc notsorted;
proc print noobs;
If you have many months of data, you'll need a more sophisticated
strategy to get all the counts in the right places, of course.
> Hi, all
> I have a dataset lookslike:
> type1 type2 type1_desc type2_desc month count
> 1 10 z_desc x_desc 200210 2
> 1 10 z_desc x_desc 200211 2
> 2 21 a_desc y_desc 200211 1
> 2 22 a_desc d_desc 200212 1
> 3 31 d_desc k_desc 200210 1
> 3 32 d_desc n_desc 200211 1
> The result should be presented as following:
> type1_desc type2_desc 200210 200211 200212
> z_desc x_desc 2 2 .
> a_desc y_desc . 1 .
> a_desc d_desc . . 1
> d_desc k_desc 1 . .
> d_desc n_desc . 1 .
> type1,type2 are not presented, type1_desc,type2_desc are sorted
> by the corresponding type1,type2, not alphabetically.
> I used 'proc tabulate' to generate the layout, however, type1_desc
> type2_desc are sorted alphabetically. How could I order
> type1_desc,type2_desc according to type1,type2? Thank you.