LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (July 2008, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 30 Jul 2008 12:22:23 -0400
Reply-To:     KNuak <asom77@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         KNuak <asom77@HOTMAIL.COM>
Subject:      current minus previous value/another approach with SAS?
Content-Type: text/plain; charset=ISO-8859-1

Hello, Does anyone know of any other method (apart from the dif and the ifn functions) to find Current minus previous values? I have dataset1 below and calculated dht= differences in ht(ie.current – previous) and dawk=differences in awk(ie. current minus previous) all by id below and obtained the results(output) in dataset2 below, using the ifn and the dif functions. *I want another approach to address the problem. Ie. an alternative method, not using the ifn and the dif functions. ANY ADVICE, PLEASE ON USING A DIFFERENT SAS CODE, instead of the ifn and the dif functions. used the following SAS code to obtain the output in dataset2: Data b; Set a; /*a contains dataset1*/ By id; Dht=ifn(first.id,(.), dif(ht)); Dawk=ifn(first.id,(.),dif(awk)); Run;

Dataset1: id awk ht 29 4.3607 188 29 7.1803 310 29 9.9672 355 31 2.0656 112 31 3.1148 156

Dataset 2: id awk ht dht dawk 29 4.3607 188 . . 29 7.1803 310 122 2.81967 29 9.9672 355 45 2.78689 31 2.0656 112 . . 31 3.1148 156 44 1.04918


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