Date: Sun, 7 May 2006 14:33:31 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: Another question on totals and subtotals
So what is the question?
On Sun, 7 May 2006 09:57:08 -0700, xxu8810152@GMAIL.COM wrote:
>Hello everyone,
>
>Thank you so much for the help on my previous two posts. I have a new
>question in the same direction. Now I have more than one dataset, say
>temp1 and temp2 where
>
>temp1 (from temp1) looks like
> Region City Sales
>1 a 200
>1 b 233
>1 c 3900
>2 d 809
>2 e 99
>2 g 11
>3 h 22
>3 r 100
>3 t 203
>3 y 2333
>
>and temp2 (from temp2) looks like
>
> Region City Sales
>1 a 130
>1 b 200
>1 c 900
>2 d 80
>2 e 19
>2 g 21
>3 h 30
>3 r 100
>3 t 300
>3 y 500
>
>And I need to generate a report for temp1 like
>
> Region City Sales
>1 a 200
>1 b 233
>1 c 3900
>1 total 4333
>2 d 809
>2 e 99
>2 g 11
>2 total 919
>3 h 22
>3 r 100
>3 t 203
>3 y 2333
>3 total 2658
> countrywide 7910
> region 1 & 2 5252
>region 1 & 2 & city=r 5352
>
>But for temp2 the report will look like
>
> Region City Sales
>1 a 130
>1 b 200
>1 c 900
>total 1230
>2 d 80
>2 e 19
>2 g 21
>total 180
>3 h 30
>3 r 100
>3 t 300
>3 y 500
>total 930
>contrywide 2340
>region 2 & 3 1110
>region 1 & 3 & city=e 2179
>
>I plan to write one macro to process several cases such that the macro,
>given the dataset name as an input, can automatically calculate
>different totals from the two datasets. In my case, the dataset names
>are fixed, so they don't change and can be used as an input.
>
>Thank you!
|