Date: Sun, 28 May 2006 17:51:53 -0400
Reply-To: "Jumbo Shrimps, Jr." <jumbo_shrimps@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Jumbo Shrimps, Jr." <jumbo_shrimps@HOTMAIL.COM>
Organization: Posted via Supernews, http://www.supernews.com
Subject: Re: Loopy question
I would love to provide a sample, but the connection to the
ancient IBM mainframe is through an emulator that - believe it
or not - still has a menu item for your daily biorhythm!!!
The terminal is fixed @ 80 char, and the data is way beyond that,
so I'd have to cut-and-paste in some kind of funky way to match
row-to-row. When I get back in on the 31st, I'll figure out a way
to download the data in text format, but until then,
I assert the data is clean, this code is in some way, aggregating the
data incorrectly, I just don't know how.
"Eric Eyre" <eeyre@concentric.net> wrote in message
news:2Z8eg.17078$JW5.14273@southeast.rr.com...
> JS
>
> Looks like a real interesting problem, but please post an input data
sample
> that corresponds to your aggregated results. BTW dude the legacy code
looks
> like it was written about the time disco was popular, time for an update
> maybe with Proc SQL
>
> "Jumbo Shrimps, Jr." <jumbo_shrimps@hotmail.com> wrote in message
> news:127h48fehoh1092@corp.supernews.com...
> > Code below generates a table, but
> > <occaisonally> the grouping mechanism
> > aggregates an individual record by itself
> > instead of adding it somewhere in the
> > other groupings(month).
> > Table looks like this:
> >
> > Score Month Accts
> > 500 0 1
> > 1 500
> > 2 450
> > 3 423
> > 4 419
> > 5 404
> > 550 0 1
> > 1 894
> > 2 855
> > 3 825
> > 4 807
> > 5 798
> > .... (to 84 months).
> >
> > (accts starts with a value
> > and decreases - or stays
> > constant by month -
> > this is a liquidation curve).
> > However there CAN'T be
> > one account at month 0
> > and then "X" (an integer
> > higher than 1) in month 1.
> >
> > Table should look like this:
> > Score Month Accts
> > 550 0 894
> > 1 855
> > 2 825
> > 3 807
> > 4 798
> >
> > Month 1 is always less than
> > (or equal to), month 0, month 2 is always
> > less than (or equal to), month 1,
> > month 3 is always
> > less than (or equal to), month 2 etc.
> >
> > Code is below, month variable is "Datamon".
> > This is legacy code I inherited. I assert it will
> > never work, but powers that be say it can be
> > made to work. Could be something around lines
> > 16 or 21 where the data read in is sorted.
> > I'm not sure, I just know the output is not
> > correct.
> >
> >
> > 1 DATA TEMP;
> > 2 SET IN1.A
> > 3 ;
> > 4 BY SSN IB_PRINC DATAMON;
> > 5
> > 6
> > 7
> > 8 ATTRIB NOTE_DT LENGTH=6 FORMAT=MMDDYY8.
> > 9 LABEL='CONSTRUCTED ACCT ORIGINAL NOTE DATE';
> > 10 RETAIN NOTE_DT;
> > 11 IF FIRST.IB_PRINC THEN NOTE_DT=NOTE_DY;
> > 12
> > 13 RUN;
> > 14
> > 15 PROC SORT DATA=TEMP TAGSORT;
> > 16 BY SSN NOTE_DT IB_PRINC DATAMON;
> > 17 RUN;
> > 18
> > 19 DATA TEMP;
> > 20 SET TEMP;
> > 21 BY SSN NOTE_DT IB_PRINC DATAMON;
> > 22
> > 23 ATTRIB
> > 24 ACCTSEQ LENGTH=3 LABEL='ACCOUNT SEQ #'
> > 25 ACCTAGE LENGTH=3 LABEL='ACCOUNT AGE (MONTHS)'
> > 26 VINTAGE LENGTH=3 LABEL='CUSTOMER VINTAGE AGE (MONTHS)'
> > 27 PC_INT LENGTH=8 LABEL='AMT OF LST PMT APPLIED TO INT - PC
ONLY'
> > 28 CLOSE_DY LENGTH=6 LABEL='ACCT CLOSING DATE' FORMAT=YYMMDD8.
> > 29 RBO LENGTH= 3 LABEL='RBO INDICATOR (0/1)'
> > 30 ORIGSEC LENGTH= 2 LABEL='ORIG SECURITY: 1=AUTO, 2=UNSEC'
> > 31 ORIGPROD LENGTH= 3 LABEL='ORIG PROD CODE (3-DIGIT)'
> > 32 ORIGPPRD LENGTH= 3 LABEL='ORIG P_PRODCT'
> > 33 ORIGSRC LENGTH= 2 LABEL='ORIG SOURCE: 1=NEW, 2=RENEW,3=RBO'
> > 34 ORIGSOB LENGTH=$1 LABEL='ORIG SOB'
> > 35 ORIGFICO LENGTH= 3 LABEL='ORIGINAL FICO'
> > 36 ;
> > 37
> > 38 *-------------------------------------------------------------*;
> > 39 * - CREAT ACCTSEQ, ACCTAGE, VINTAGE, ECT. *;
> > 40 *-------------------------------------------------------------*;
> > 41 RETAIN ACCTSEQ ORIGSEC ORIGSOB ORIGSRC ORIGPROD ORIGPPRD ORIGFICO
> > 42 FSTDATE RBO;
> > 43 IF FIRST.SSN THEN DO;
> > 44 ACCTSEQ =1;
> > 45 FSTDATE =NOTE_DY;
> > 46 ORIGSEC =SECURITY;
> > 47 ORIGSOB =SOB;
> > 48 ORIGSRC =SOURCE;
> > 49 ORIGPROD=PROD;
> > 50 ORIGPPRD=P_PRODCT;
> > 51 ORIGFICO=FICO;
> > 52
> > 53 IF SOB='M' OR
> > 54 (SOURCE='4' AND (P_PRODCT IN ('02','04')) AND NEWCASH<1500)
> > 55 THEN RBO=1;
> > 56 ELSE RBO=0;
> > 57 END;
> > 58 ELSE IF FIRST.IB_PRINC THEN DO;
> > 59 ACCTSEQ =ACCTSEQ+1;
> > 60 IF SOB='M' OR
> > 61 (SOURCE='4' AND (P_PRODCT IN ('02','04')) AND NEWCASH<1500)
> > 62 THEN RBO=1;
> > 63 ELSE RBO=0;
> > 64 END;
> > 65
> > 66 ACCTAGE=INTCK('MONTH', NOTE_DT, DATAMON);
> > 67 VINTAGE=INTCK('MONTH', FSTDATE, DATAMON);
> > 68 DROP FSTDATE;
> > 69
> > 70 CLOSE_DY=MAX(PO_DY, CO_DY);
> > 71
> > 72
> > 73 RETAIN REMFC;
> > 74 IF INTEREST='0' THEN DO;
> > 75 IF FIRST.IB_PRINC THEN DO;
> > 76 PC_INT=BUD_FC - RUD_FC;
> > 77 REMFC =RUD_FC;
> > 78 END;
> > 79 ELSE DO;
> > 80 IF OPEN='1' THEN PC_INT=SUM(REMFC, -RUD_FC);
> > 81 ELSE PC_INT=SUM(REMFC, -INT_RFND);
> > 82 REMFC =RUD_FC;
> > 83 END;
> > 84 END;
> > 85
> > 86 DROP REMFC;
> > 87 RUN;
> > 88
> > 89 PROC SORT DATA=TEMP (%VARLIST)
> > 90 OUT =OUT.A (COMPRESS=YES
> > 91 LABEL='RE00 VINT, 60M HISTORY, ABBREV.')
> > 92 TAGSORT;
> > 93 BY SSN ACCTSEQ DATAMON;
> > 94 RUN;
> > 95
> > 96 PROC PRINT DATA=OUT.A (OBS=300) UNIFORM;
> > 97 BY SSN;
> > 98 ID SSN;
> > 99 VAR ACCTSEQ PRODUCT NOTE_DY NOTE_DT IB_PRINC DATAMON
> > 100 VINTAGE ACCTAGE NEWCASH SECURITY CLOSE_DY SOB PO_RE
> > 101 ;
> > 102 FORMAT PO_RE $PORE.
> > 103 SOB $SOA.
> > 104 ;
> > 105 FOOTNOTE 'BDCMTM.RE02.CNTL(COMBINE)';
> > 106 RUN;
> > 107 *NDSAS;
> > 108
> > 109 PROC CONTENTS DATA=OUT.A;
> > 110 RUN;
> >
> >
> >
>
>
|