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 2000, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 10 Jan 2000 22:07:26 +0100
Reply-To:     "Christian F.G. Schendera" <schendera@NIKOCITY.DE>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Christian F.G. Schendera" <schendera@NIKOCITY.DE>
Subject:      simultaneous computation of two functions of annual developments
              in percentages (first solved, second perhaps)
Comments: To: SASL <SAS-L@UGA.CC.UGA.EDU>
Content-Type: text/plain; charset="iso-8859-1"

Hi there! Obviously I suffered from a heavy programmer's block. Over the weekend I sent the following two questions. The first is solved for sure (about the second I am a bit unsure): >I have to compute two annual developments in percentages. Both computations >have their peculiarities. As the second bases on the first analysis, it >would be wonderful to code them it in such a way that both questions could >be analyzed simultaneously. >1. Difference within (!) each YEARPAIR (see note below) in percentages (per >BIRDTYPE and METHOD). SOLUTION (very easy) : PDIFF = QJ2 - QJ1 ; PCTDIFF = (PDIFF/QJ1)*100 ;

Output looks like this: OBS JAHRPAAR JAHR1 JAHR2 VOGELART METHODE QJ1 QJ2 PDIFF PCTDIFF 1 92/93 1992 1993 Amsel L 16.5 21.5 5.0 30.303 2 92/93 1992 1993 Bachstelze L 18.5 12.0 -6.5 -35.135 3 92/93 1992 1993 Baumpieper L >2. Now I want to standardize the obtained % differences. The start value is >100%, then I apply the PCTDIFFS to the 100%. Result could look like this >(PCTDEV= %). >BIRDTYPE METHOD 92/93 >93/94............. >blackbird L +124.24 (+24.24 to start value 100%) >112.68 (124.24-9.30%)............. >finch P ................ Here I use the lag function (although I am not very sure if there is a more elegant solution): data PCTVLF2 ; set PCTVLF1 ; by VOGELART METHODE ; a=lag(PCTDIFF) ; if first.METHODE then PCTDEV=100 ; else PCTDEV =(PCTDIFF/a*100)-100 ; put PCTDEV = ; run ; Hints very welcome. Chris


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