LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 1998, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 15 Sep 1998 08:30:31 -0400
Reply-To:     Mike.Janicke@JMAGROUP.COM
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Mike Janicke <Mike.Janicke@JMAGROUP.COM>
Subject:      Difficulty with the MERGE statement.
Content-type: text/plain; charset=us-ascii

Dear SAS-L I'm a bit confused on the following merge: The following code gives me the correct output.

*ATTACH DEALERCOST FIRST; DATA ADDTRMU(DROP=PREMNOW); MERGE ADDTRMU (IN=A) DB2PR99U (IN=B); BY TERM RATECLS COVCAT MILECAT AGECAT; IF A=1 AND B=1;

DATA ADDTRMU; SET ADDTRMU; IF DEDAMT = 50 AND COVCAT = 'G' THEN DEDADDON = 40; ELSE IF DEDAMT = 50 AND COVCAT = 'E' THEN DEDADDON = 65; ELSE IF DEDAMT = 250 AND COVCAT = 'G' THEN DEDADDON = -50; ELSE IF DEDAMT = 250 AND COVCAT = 'E' THEN DEDADDON = -105; ELSE IF DEDAMT = 100 THEN DEDADDON = 0; ELSE PUT _ALL_; DLRCOST=DLRCOST+DEDADDON;

However, if I place the dataset statements with the merge I get VERY diffrent, and incorrect!, results.

For example:

*ATTACH DEALERCOST FIRST; DATA ADDTRMU(DROP=PREMNOW); MERGE ADDTRMU (IN=A) DB2PR99U (IN=B); BY TERM RATECLS COVCAT MILECAT AGECAT; IF A=1 AND B=1;

IF DEDAMT = 50 AND COVCAT = 'G' THEN DEDADDON = 40; ELSE IF DEDAMT = 50 AND COVCAT = 'E' THEN DEDADDON = 65; ELSE IF DEDAMT = 250 AND COVCAT = 'G' THEN DEDADDON = -50; ELSE IF DEDAMT = 250 AND COVCAT = 'E' THEN DEDADDON = -105; ELSE IF DEDAMT = 100 THEN DEDADDON = 0; ELSE PUT _ALL_; DLRCOST=DLRCOST+DEDADDON;

Can anyone tell me why the first example worked and the second did not? Thanks!


Back to: Top of message | Previous page | Main SAS-L page