Date: Fri, 20 Jun 1997 10:45:45 -0400
Reply-To: Michael Stuart <mstuart@PRUDENTIAL.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Michael Stuart <mstuart@PRUDENTIAL.COM>
Subject: Getting a List of Distinct Values from an Array
Content-Type: multipart/mixed;
Boundary="0__=oWgDKSmCCpPknM9omUpgwFrUsefLrDIHenAiKrczVeA6W3iFvmRafrNO"
The following solution was suggested by KLASSEN, and is pasted below.
DO OVER COVTYP;
V1 = COVTYP;
V2 = COVUNT;
V3 = COVPLN;
V4 = COVTRM;
V5 = COVBND;
OUTPUT;
END;
DO OVER FNDNUM;
W1 = FNDNUM;
W2 =FNDVAL;
W3 =FNDUNT;
W4 =UNTVAL;
W5 =FNDTYP;
OUTPUT ;
END;
I broke this into two separate datasteps, and retained only the variables
within each loop. I then ran frequencies on these.
Many thanks to him and the others that responded.
---------------------- Forwarded by Michael Stuart/M&P/Prudential on
06/20/97 10:42 AM ---------------------------
Michael Stuart Thursday June 19, 1997 03:15 PM
IIG Market Research (201) 802-4125 Fax Number: (201) 622-3156
(Embedded image moved to file: PIC13038.PCX)
To: SAS-L@UGA.CC.UGA.EDU
cc:
Subject: Getting a List of Distinct Values from an Array
I've read data into SAS from one of our legacy systems. The dataset had
multiplying occuring segments, and I used the following arrays to read in
these sections:
* SET UP ARRAYS FOR COVERAGE FIELDS ;
ARRAY COVTYP(20) $6 COVTYP01 - COVTYP20 ;
ARRAY COVUNT(20) COVUNT01 - COVUNT20 ;
ARRAY COVPLN(20) $6 COVPLN01 - COVPLN20 ;
ARRAY COVTRM(20) COVTRM01 - COVTRM20 ;
ARRAY COVBND(20) $1 COVBND01 - COVBND20 ;
* SET UP ARRAYS FOR FUND FIELDS ;
ARRAY FNDNUM(18) FNDNUM01 - FNDNUM18 ;
ARRAY FNDVAL(18) FNDVAL01 - FNDVAL18 ;
ARRAY FNDUNT(18) FNDUNT01 - FNDUNT18 ;
ARRAY UNTVAL(18) UNTVAL01 - UNTVAL18 ;
ARRAY FNDTYP(18) $1 FNDTYP01 - FNDTYP18 ;
So now I've got either 20 or 18 occurences of each of the above fields, on
every SAS record. I want to get a list of the distinct values in each
array, without having to run frequencies on each field separately. Is
there a 'compact' way I can code this? I started to code a looping macro
that would rename and append to a new SAS dataset, but got a little bogged
down. Anyone have creative ideas?
I would appreciate a personal response to mstuart@prudential.com, in
addition to the list, as my digests seem to arrive sporadically.
Much thanks in advance.
PIC13038.PCX [application/octet-stream]