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 (March 2002, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 29 Mar 2002 13:01:23 -0500
Reply-To:     "Huang, Ya" <ya.huang@PFIZER.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Huang, Ya" <ya.huang@PFIZER.COM>
Subject:      Re: Calculating product
Comments: To: Mitch Conover <mconover@RICHMOND.EDU>
Content-Type: text/plain

data xx; input x $ y; cards; A 2 A 5 A 10 B 10 C 5 C 10 ;

data xx (drop=y); prod=1; do until(last.x); set xx; by x; prod=prod*y; end;

proc print; run;

---------------- Obs prod x

1 100 A 2 10 B 3 50 C

Regards,

Ya Huang

-----Original Message----- From: Mitch Conover [mailto:mconover@RICHMOND.EDU] Sent: Friday, March 29, 2002 8:18 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Calculating product

Hello,

I am trying to do something similiar to what Henry requested but I am trying to take the product of the variables. I know that Henry's problem is doable in proc univariate but mine is not as there is no product output variable in proc univariate.

I have altered his example to demonstrate my problem below.

Your help is appreciated.

Mitch

I have a data set (a), how to transfrom it into (b)?

(a) (b) ------------- ------------------ A 2 A 100 A 5 B 10 A 10 C 50 B 10 ------------------ C 5 C 10 -------------


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