Focal Point
[CLOSED] Multiple COUNTS

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4407053895

February 08, 2011, 09:55 AM
SRC
[CLOSED] Multiple COUNTS
Tried this post earlier but had internet problem so I don't know if it made it. Sorry for the duplicate.

Customer wants to count ethnicity by gender and also count race by gender

  

--GENDER----ETHNIC----COUNT----RACE------COUNT
   M        HISP       5       AI-AK      1
            NON-HISP   2       AS         2
                               BL-AA      1
                               HI-PI      3
                               WH         1
                               ND         1


The following code of course results in (FOC020) THE SETS OF SORT PHRASES ARE INCONSISTENT

SUM CNT.ID
BY GENDER
BY ETHNICITY

SUM CNT.ID
BY GENDER
BY RACE



Is there a way to do multiple counts when the sort fields don't match?

This message has been edited. Last edited by: Kerry,


Dev Studio /7.6.11/7.7.02M
MVS/USS
AIX/SOLARIS
Windows WF Client 7.6.8/7.6.11
February 09, 2011, 02:36 AM
Dave
Does it really have to be in this layout?

SUM CNT.ID
BY GENDER
BY ETHNICITY
ACROSS RACE


Would do the trick nicely. Just add row and column-totals and you've got everything.


G'luck,
Dave


_____________________
WF: 8.0.0.9 > going 8.2.0.5
February 09, 2011, 03:19 AM
atturhari
SUM CNT.ID
BY GENDER
BY ETHNICITY

SUM CNT.ID
BY GENDER
BY ETHNICITY
BY RACE


Hold the data and then resort.


WF 7.7.02 on Windows 7
Teradata
HTML,PDF,EXCEL,AHTML
February 09, 2011, 10:20 AM
j.gross
Something like this...
SUM CNT.ID/I5S AS count1
COMPUTE seq/I4=seq+1;
BY GENDER
BY ETHNICITY
...HOLD AS HOLD1...

SUM CNT.ID/I5S AS count2
COMPUTE seq/I4=seq+1;
BY GENDER
BY RACE
...HOLD AS HOLD2...

MATCH FILE HOLD1 PRINT ETHNICITY count1  BY seq BY GENDER
RUN
      FILE HOLD2 PRINT RACE count2  BY seq BY GENDER
AFTER MATCH HOLD AS HOLD3 OLD-OR-NEW

TABLE FILE HOLD3
PRINT 
ETHNIC
count1 AS COUNT
RACE
count2 AS COUNT
BY GENDER
BY seq NOPRINT
...



- Jack Gross
WF through 8.1.05