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 (October 2001, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 29 Oct 2001 17:10:40 -0500
Reply-To:     Boyd Newlin <bnewlin@INSMED.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Boyd Newlin <bnewlin@INSMED.COM>
Subject:      Re: stepping through arrays ...
Comments: To: "greg.woolridge@TAP.com" <greg.woolridge@TAP.com>
Content-Type: text/plain; charset="iso-8859-1"

Thanks Greg,

I was working with that method also .... what I got from your code was the dim function ... totally forgot about that one. Thanks. BUT Then I decided not to use arrays at all. But you did start me out in the right direction. This is what I'm working on so far. I needed to assign each mean to it's own variable. Yes I could of used arrays but I thought the macro solution is easier. Both loops will give me different means (haven't decided which one I want to use). In either case I plan to take the lowest mean of either method and use it for a baseline value. That's really the whole reason for doing this.

%macro t;

data ratio; set test;

%do i=1 %to (180-5) %by 5;

ave&i=mean(of d&i - d%eval(&i+4));

%end;

%do i=1 %to 180 -5;

xave&i=mean(of d&i - d%eval(&i+4));

%end;

/*for checking */

avet1=mean(of d1-d5);

avet2=mean(of d6-d10);

avet3=mean(of d11-d15);

avet4=mean(of d16-d20);

avet5=mean(of d21-d25);

avet6=mean(of d26-d30);

avex1=mean(of d1-d5);

avex2=mean(of d2-d6);

avex3=mean(of d3-d7);

avex4=mean(of d4-d8);

avex5=mean(of d5-d9);

avex6=mean(of d6-d10);

run;

%mend;

%t; -----Original Message----- From: greg.woolridge@TAP.com [mailto:greg.woolridge@TAP.com] Sent: Monday, October 29, 2001 4:00 PM To: Stumped Cc: SAS-L@LISTSERV.UGA.EDU Subject: Re: stepping through arrays ...

You can get your averages by using an array and DO loops:

array dd {*} d1-dn; *n must be an integer, macro variable containing integer, or expression resulting in integer)0:

do x=1 to (dim(dd)-5) by 5; *gives averages of d1-d5, d6-d10, etc; average= (sum(dd(x), dd(x+1), dd(x+2), dd(x+3), dd(x+4), dd(x+5)))/5; end;

do x=1 to (dim(dd)-5); Z*gives averages of d1-d5, d2-d6, etc; average= (sum(dd(x), dd(x+1), dd(x+2), dd(x+3), dd(x+4), dd(x+5)))/5; end;

You will need to modify the loops to fit your needs, but this should give you a general idea of how to generate the averages.

I don't know how you want to compare them once they are generated (d1-d5 compared to d2-d6?, d5-d10 compared to ???), so I don't offer any help on that.

HTH

Greg M. Woolridge Manager, Study Programming TAP Pharmaceutical Products Inc. e-mail: greg.woolridge@tap.com phone: 847-582-2332 fax: 847-582-2403

Stumped

<bnewlin@INSME To: SAS-L@LISTSERV.UGA.EDU

D.COM> cc:

Sent by: Subject: stepping through arrays ... "SAS(r)

Discussion"

<SAS-L@LISTSER

V.UGA.EDU>

10/29/01 02:28

PM

Please respond

to Stumped

I have a list of variables d1-dnth and I'm looking for a quick solution to computing the average of d1-d5, d6-d10, etc. AND and also compute the average of d1-d5, d2-d6, d3-d7, etc. Then compare the differences in averages between the two methods.

I've played around with it but now i'm resorting to SAS-L hoping to get someone to point me in the right direction.

Thank You.


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