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 (January 1998, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 27 Jan 1998 15:51:55 -0500
Reply-To:     westerlu@delphi.kodak.com
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Earl Westerlund <earlw@KODAK.COM>
Organization: Eastman Kodak Company
Subject:      Re: (no subject given)
Content-Type: text/plain; charset=us-ascii

Carlos, I just ran your example on 6.12 TS020 under NT Workstation 4.0. It did not produce the same output, but rather only replaced the one value, as you expected.

What version of SAS, and on what OS? And, would it be possible to use the UPDATE statement instead?

Carlos Garces wrote: > > Dear SAS-L experts, > > I don't know what is happening, but maybe some of the SAS > gurus could help me out. I've simplified the code so it > is easier to follow: > > %MACRO HARDCODE(ID,VARIABLE,OLDVAL,NEWVAL); > IF PAT=&ID AND &VARIABLE=&OLDVAL THEN DO; > PUT 'PREVIOUS ' PAT= &VARIABLE=; > &VARIABLE=&NEWVAL; > PUT 'NEW VALUE ' PAT= &VARIABLE=; > END; > ELSE IF PAT=&ID THEN DO; > PUT "CONDITION FOR " PAT= " NOT MET - OLD VALUE: &OLDVAL - CURRENT > VALUE: " &VARIABLE=; > END; > %MEND; > > data pistart; > do pat=630 to 640; > output; > end; > > data temp; > do pat=865 to 882; > update='27JAN98'D; > output; > FORMAT UPDATE MMDDYY8.; > end; > > data pistart; > set pistart temp; > %HARDCODE(635,update,.,'27jan98'd); > run; > > If you see the output below, you will notice that > the value for variable UPDATE is retained! > > This doesn't happen if I use a 'by pat' statement. I also > cannot replicate this situation if I use an IF statement > instead of the macro. > > proc print data=pistart; > run; > > OBS PAT UPDATE > > 1 630 . > 2 631 . > 3 632 . > 4 633 . > 5 634 . > 6 635 01/27/98 > 7 636 01/27/98 > 8 637 01/27/98 > 9 638 01/27/98 > 10 639 01/27/98 > 11 640 01/27/98 > 12 865 01/27/98 > 13 866 01/27/98 > 14 867 01/27/98 > 15 868 01/27/98 > 16 869 01/27/98 > 17 870 01/27/98 > 18 871 01/27/98 > 19 872 01/27/98 > 20 873 01/27/98 > 21 874 01/27/98 > 22 875 01/27/98 > 23 876 01/27/98 > 24 877 01/27/98 > 25 878 01/27/98 > 26 879 01/27/98 > 27 880 01/27/98 > 28 881 01/27/98 > 29 882 01/27/98

-- +-----------------+----------------------------------------+ | Earl Westerlund | Kodak's Homepage: http://www.kodak.com | +-----------------+----------------------------------------+ | The opinions expressed herein are mine and mine alone | | (most people don't seem to want them anyway) | +----------------------------------------------------------+


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