Date: Wed, 13 Oct 2010 16:47:37 -0400
Reply-To: Nat Wooding <nathani@VERIZON.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nat Wooding <nathani@VERIZON.NET>
Subject: Re: Data Step Counts Twice
In-Reply-To: <5B1372272ABB7B4DB178622784D52BC10877DE1A77@MOR-EXMBPRD01.bvnet.bv>
Content-Type: text/plain; charset="iso-8859-1"
Ricardo
Try turning off the XCUM and YCUM in the Dados data step.
Nat Wooding
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Ricardo
Gonçalves da Silva
Sent: Wednesday, October 13, 2010 4:17 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Data Step Counts Twice
Hi,
In the following, the second data step calculates de cumulative probability
for DEFAULTS_Y and DEVEDORES_X.
However, when I compute YCUM_TOT and XCUM_TOT SAS counts the last lines
twice. Note that, for XCUM_TOT I need to put minus 100 (the last value) to
achieve the right value. The same just don´t happened with YCUM_TOT because
the final value is zero. Any hints??
Thanks.
DATA DADOS;
INPUT ALEATORIO PD_REAL RATING DEVEDORES_X DEFAULTS_Y;
XCUM+DEVEDORES_X;
YCUM+DEFAULTS_Y;
CARDS;
0 0.2304 1 50 11
10 0.1152 2 75 8
20 0.0576 3 100 5
30 0.0288 4 150 4
40 0.0144 5 225 3
50 0.0072 6 300 2
60 0.0036 7 400 1
70 0.0018 8 500 0
80 0.0009 9 550 0
90 0.0008 10 500 0
100 0.0007 11 400 0
. 0.0006 12 250 0
. 0.0005 13 225 0
. 0.0004 14 150 0
. 0.0003 15 100 0
. 0.0003 16 75 0
. 0.0003 17 50 0
;
RUN;
/*CALCULATE CUMULATIVE PERCENTS*/
DATA FREQS;
DO _N_ = 1 BY 1 UNTIL (EOF);
SET DADOS END=EOF;
YCUM + DEFAULTS_Y;
XCUM + DEVEDORES_X;
END;
YCUM_TOT = YCUM;
XCUM_TOT = XCUM-100;
EOF=0;
DO _N_ = 1 BY 1 UNTIL (EOF);
SET DADOS END=EOF;
YCUMPCT = YCUM / YCUM_TOT;
XCUMPCT = XCUM / XCUM_TOT;
OUTPUT;
END;
RUN;
Esta mensagem e seus anexos podem conter informações confidenciais ou
privilegiadas. Se você não é o destinatário dos mesmos você não está
autorizado a utilizar o material para qualquer fim. Solicitamos que você
apague a mensagem e avise imediatamente ao remetente. O conteúdo desta
mensagem e seus anexos não representam necessariamente a opinião e a
intenção da empresa, não implicando em qualquer obrigaçâo ou
responsabilidade da parte da mesma.
This message may contain confidential and/or privileged information. If you
are not the addressee or authorized to receive this for the addressee, you
must not use, copy, disclose or take any action based on this message or any
information herein. If you have received this message in error, please
advise the sender immediately by reply e-mail and delete this message. The
contents of this message and its attachments do not necessarily express the
opinion or the intention of the company, and do not implies any legal
obligation or responsibilities from this company.