Date: Mon, 15 Dec 1997 18:14:47 -0500
Reply-To: Victor Kamensky <kamensky@AECOM.YU.EDU>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Victor Kamensky <kamensky@AECOM.YU.EDU>
Subject: Strange results
Content-Type: text/plain; charset="us-ascii"
Dear SAS-L-ers!
Please take a look at the following log.
I run the same program twice.
The difference between first and second run is that
proc sort is taken out.
First run gives wrong results,second-correct.
Data base d2 is empty.
(Another way of getting correct results
is to drop QUARTER from d2,although d2 is empty).
It does not make any sense.
Any ideas?
Sincerely
Victor Kamensky
Programmer
Albert Einstein College of Medicine
18313 *dtt.sas;
18314 *FIRST RUN-WRONG RESULTS;
18315 PROC DBF DB4=d1 OUT=d1(keep=id qnum05);RUN;
NOTE: 937 observations written to the output SAS data set.
NOTE: The PROCEDURE DBF used 0.22 seconds.
18316 PROC DBF DB4=d2 OUT=d2(keep=acrostic quarter);RUN;
NOTE: 0 observations written to the output SAS data set.
NOTE: The PROCEDURE DBF used 0.05 seconds.
18317 proc sort data=d1; by id; run;
NOTE: The data set WORK.D1 has 937 observations and 2 variables.
NOTE: The PROCEDURE SORT used 0.11 seconds.
18318 data d1 d3;
18319 set d1 d2(keep=acrostic quarter);
18320 if qnum05=9 then quarter=4;
18321 if quarter =4 then output d3;
18322 else output d1;
18323 run;
NOTE: The data set WORK.D1 has 359 observations and 4 variables.
NOTE: The data set WORK.D3 has 578 observations and 4 variables.
NOTE: The DATA statement used 0.55 seconds.
18324
18325 *SECOND RUN-NO SORTING-CORRECT RESULT;
18326 PROC DBF DB4=d1 OUT=d1(keep=id qnum05);RUN;
NOTE: 937 observations written to the output SAS data set.
NOTE: The PROCEDURE DBF used 0.16 seconds.
18327 PROC DBF DB4=d2 OUT=d2(keep=acrostic quarter);RUN;
NOTE: 0 observations written to the output SAS data set.
NOTE: The PROCEDURE DBF used 0.05 seconds.
18328 *proc sort data=d1; *by id; run;
18329 data d1 d3;
18330 set d1 d2(keep=acrostic quarter);
18331 if qnum05=9 then quarter=4;
18332 if quarter =4 then output d3;
18333 else output d1;
18334 run;
NOTE: The data set WORK.D1 has 704 observations and 4 variables.
NOTE: The data set WORK.D3 has 233 observations and 4 variables.
NOTE: The DATA statement used 0.44 seconds.