SWICKHAM@DARTCMS1.BITNET (Steve Wickham) (01/14/90)
Hello all: I'm having a problem using an array statement properly in a data step. The object of the exercise is to calculate growth rates between time periods. When I have only 1 variable, the following code works fine: PROC SORT DATA=ALL;BY BAG DATE; DATA NEW;SET ALL;BY BAG; IF FIRST.BAG THEN OLDNUM=TOTCIL; GROWTH=LOG(TOTCIL/OLDNUM)/3; /*THREE DAY TIME PERIODS*/ OLDNUM=TOTCIL;RETAIN OLDNUM; The problem comes when I wish to calculate the growth of multiple variable simultaneously. I thought an array statement would be the way to go, ie.: DATA NEW;SET ROT;BY BAG; ARRAY GROWTH NAUP COPEPOD PVULG KEARL KCOCHL KLONG LEPAD CONOCHIL KBOST CHIRON FILINIA; DO OVER GROWTH; IF FIRST.BAG THEN OLDNUM=GROWTH; GROWTH=LOG(GROWTH/OLDNUM)/3; OLDNUM=GROWTH;RETAIN OLDNUM; END; If I understand the logic of the array statement, my problem comes when I rename the array variable - I need a unique name for each variable to be held to the next data line. Is there a solution to my problem? Have I even identified the problem correctly? Any suggestions would be appreciated. For the record we use SAS v.5.18 on VM/CMS. Thanks, Steve Wickham Dept. of Biology Dartmouth College bitnet: swickham@dartcms1