knowledge-database (beta)

Current group: comp.soft-sys.sas

How to generate a report like this...(Revised)

How to generate a report like this...(Revised)  
Littleinfo
 Re: How to generate a report like this...(Revised)  
Richard A. DeVenezia
From:Littleinfo
Subject:How to generate a report like this...(Revised)
Date:Sat, 22 Jan 2005 15:56:42 +0800
This is a multi-part message in MIME format.

------=_NextPart_000_00CF_01C5009A.F72B70B0
Content-Type: text/plain;
charset="big5"
Content-Transfer-Encoding: quoted-printable

Dear all SAS-experts,

I've a table similar to Table 1 and would like to generate a =
report/table
similar to Table 2. How can I do that in SAS if I've only got SAS/BASE?

Table 1
id segment indicator amount sales
10002 A =A1@ 1,000 =
111
10003 B =A1@ 20,000 =
333
10004 C 1 500,000 =
222
10005 D =A1@ 555 =
444
10006 C 1 487,878 =
555
10007 D =A1@ 5,555 =
666
10008 A =A1@ 7,877 =
555
10009 C 1 45,556 =
666
10010 A =A1@ 2,222 =
222
10011 B =A1@ 12,345 =
111
10012 C =A1@ 8,855 =
111
10013 D =A1@ 7,777 =
333
10014 B 1 47,777 =
555
10015 A =A1@ 5,588 =
444
10016 C =A1@ 45 =
666

Table 2
Sales | Segment | Segment and with =
Indicator=3D1
| A B C D | A B C =
D
-------------------------------------------------------------------------=
--------------------
111 |=A1@ =A1@ =A1@ =A1@ |=A1@ =A1@ =A1@ =A1@
222 =A1@ |=A1@ =A1@ =A1@ |=A1@ =A1@ =A1@ =A1@
333 =A1@ |=A1@ =A1@ =A1@ |=A1@ =A1@ =A1@ =A1@
444 =A1@ |=A1@ =A1@ =A1@ |=A1@ =A1@ =A1@ =A1@
555 =A1@ |=A1@ =A1@ =A1@ |=A1@ =A1@ =A1@ =A1@
666 =A1@ |=A1@ =A1@ =A1@ |=A1@ =A1@ =A1@ =A1@


Thanks in advances!

Best regards
littleinfo



------=_NextPart_000_00CF_01C5009A.F72B70B0
Content-Type: text/html;
charset="big5"
Content-Transfer-Encoding: quoted-printable








Dear all SAS-experts,

I've a =
table similar=20
to Table 1  and would like to generate a report/table
similar to =
Table=20
2. How can I do that in SAS if I've only got SAS/BASE?

Table=20
1
      id     =
   =20
        segment    =20
indicator    amount     =
   =20
sales
size=3D3>
     =20
10002         A=20
=A1@           &nb=
sp;   =20
            =
   =20
1,000         =20
111
      10003    =20
    B=20
=A1@           &nb=
sp;  =20
            =
   =20
 20,000        333
 =
    =20
10004         C    =20
           =20
1            =
      500,000 =20
    222
      10005=20
        D=20
=A1@           &nb=
sp;   =20
            =
   =20
555           &nbs=
p; 444
     =20
10006         C    =20
           =20
1            =
      487,878 =20
    555
      10007=20
        D=20
=A1@           &nb=
sp;           &nbs=
p;        5,555 =20
        =
666
     =20
10008         A=20
=A1@           &nb=
sp;           &nbs=
p;        7,877   =
       555
    =
 =20
10009         C    =20
           =20
1            =
      45,556     &=
nbsp;  666
     =20
10010         A=20
=A1@           &nb=
sp;           &nbs=
p;        2,222 =20
        =
222
     =20
10011         B=20
=A1@           &nb=
sp;           &nbs=
p;        12,345   =
;     111
     =20
10012         C=20
=A1@           &nb=
sp;           &nbs=
p;        8,855 =20
        =
111
     =20
10013         D=20
=A1@           &nb=
sp;           &nbs=
p;       7,777    =
      333
     =
=20
10014         B    =20
            1 =
   =20
           =20
47,777       =20
555
      10015    =20
    A=20
=A1@           &nb=
sp;           &nbs=
p;       5,588    =
      444
     =
=20
10016         C=20
=A1@           &nb=
sp;           &nbs=
p;       45    &nb=
sp;          666
=

 

Table =
2
     =20
Sales    =20
|         Segment  =
;         |   =
;    Segment=20
and with=20
Indicator=3D1
         &n=
bsp;        =20
|  A     B    C    D=20
      |   A   =20
    B       C=20
        D

size=3D3>----------------------------------------------------------------=
-----------------------------
     =20
111       |=A1@ =A1@ =A1@=20
=A1@           &nb=
sp;  |=A1@=20
=A1@ =A1@ =A1@
      222 =
=A1@  |=A1@ =A1@=20
=A1@           &nb=
sp;       |=A1@=20
=A1@ =A1@ =A1@
      333 =
=A1@  |=A1@ =A1@=20
=A1@           &nb=
sp;       |
size=3D2>=A1@ =A1@ =A1@ =
=A1@
      444=20
=A1@  |=A1@ =A1@=20
=A1@           &nb=
sp;       |=A1@=20
=A1@ =A1@ =A1@
      555 =A1@  |=A1@ =
=A1@=20
=A1@           &nb=
sp;       |=A1@=20
=A1@ =A1@ =A1@
      666 =A1@  |=A1@ =
=A1@=20
=A1@           &nb=
sp;       |=A1@=20
=A1@ =A1@ =A1@


Thanks in advances!

Best=20
regards
littleinfo





------=_NextPart_000_00CF_01C5009A.F72B70B0--
From:Richard A. DeVenezia
Subject:Re: How to generate a report like this...(Revised)
Date:Sat, 22 Jan 2005 14:57:41 -0500
Littleinfo wrote:
> Dear all SAS-experts,
>
> I've a table similar to Table 1 and would like to generate a
> report/table
> similar to Table 2. How can I do that in SAS if I've only got
> SAS/BASE?
....
> Table 2
> Sales | Segment | Segment and with
> Indicator=1
> | A B C D | A B C
> D
> --------------------------------------------------------------------------
-------------------
> 111 |¡@ ¡@ ¡@ ¡@ |¡@ ¡@ ¡@ ¡@
> 222 ¡@ |¡@ ¡@ ¡@ |¡@ ¡@ ¡@ ¡@
> 333 ¡@ |¡@ ¡@ ¡@ |¡@ ¡@ ¡@ ¡@
> 444 ¡@ |¡@ ¡@ ¡@ |¡@ ¡@ ¡@ ¡@
> 555 ¡@ |¡@ ¡@ ¡@ |¡@ ¡@ ¡@ ¡@
> 666 ¡@ |¡@ ¡@ ¡@ |¡@ ¡@ ¡@ ¡@

Proc TABULATE.
Class vars are Sales, Indicator, Segment.

Something like
TABLE Sales, indicator*segment.

What does ¡@ represent ?
Is second group of ABCD mutually exclusive with respect to first group of
ABCD, or do you want stuff from first group included in second group ?
(i.e. do you want indicator to act as an discriminator, or as a state
marker?)
Is your desired table 2 wrongly presented ? I presume the ¡@ should be to
the right of the | in rows 222,333,etc.
Are you going to do anything with sales ?

--
Richard A. DeVenezia
http://www.devenezia.com/
   

Copyright © 2006 knowledge-database   -   All rights reserved