I am trying to get a count of members per network, product, line of business, zip and county. It works until I add in County. Then I get duplicate rows and it splits the totals as if the county is different, when it's not (All rows are Los Angeles County). I have tried removing county from the group by, but not select statement, and then I still get duplicate rows only with the same count on the dup row. The count only works if I remove the County from both the group by and the Select (and order by). I have tried format and length statements as well as trimming the County. Nothing works. My code and sample data examples are below: Proc SQL; Create Table ActualMbrshp AS Select Distinct TRIM(NTWK_NM) as NTWK_NM ,TRIM(NWID.NetworkID) as NetworkID ,CAT(TRIM(ProdLvl2)," ",TRIM(MBULvl2)) as LineofBusiness ,TRIM(ProdNm) as ProdNm ,TRIM(UPPER(County)) as County format =$20. length=20 ,TRIM(Zip) as Zip ,Count (*) as Count From Mbrshp.PSHMO_Membership as mbr left join Mbrshp.NetworkIds as NWID on UPPER(NWID.NetworkName)=mbr.NTWK_NM Where Zip = "90001" Group by NTWK_NM, LineofBusiness, ProdNm, County, Zip Order By NTWK_NM, LineofBusiness, ProdNm, County, Zip; Result: Desired Result (only with county name included): Any help is much appreciated!
... View more