Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- SAS Product Function

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-05-2010 03:46 PM

I need calculate the product of a series of variables, for instance: var1 var2 ... var100, I need the product of var1-var100, instead of var1*var2*...*var100, is there a simple way to calculate that result?

I assume there should be some fuction to do that, just like the sum of var1-var100 could be done by sum(of var1-var100). I check function product but it doesn't seem the right way.

Greatly appreciate any suggestions and help!

I assume there should be some fuction to do that, just like the sum of var1-var100 could be done by sum(of var1-var100). I check function product but it doesn't seem the right way.

Greatly appreciate any suggestions and help!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-06-2010 06:08 AM

There is no product function as much as I know.

Some code like below might help:

data have;

var1=5; var2=3;

run;

%let prodlist=;

proc sql noprint;

select name into rodList separated by '*'

from dictionary.columns

where libname='WORK' and memname='TEST' and upcase(name) like 'VAR%'

;

quit;

data want;

set have;

product=&prodlist;

put product=;

run;

Some code like below might help:

data have;

var1=5; var2=3;

run;

%let prodlist=;

proc sql noprint;

select name into rodList separated by '*'

from dictionary.columns

where libname='WORK' and memname='TEST' and upcase(name) like 'VAR%'

;

quit;

data want;

set have;

product=&prodlist;

put product=;

run;