As the title, what is the sas function of ∏?
Why not use the GEOMEAN function and then convert it to the product using power operator?
product = geomean(of x1-x3) ** n(of x1-x3);
Could you provide more information as to what extactly you have and are trying to accomplish...
![]() | product over … from … to … of | means a1a2···an. | = (1+2)(2+2)(3+2)(4+2)
| |
the Cartesian product of; | means the set of all (n+1)-tuples
| ![]() |
SAS Product Function (part of SAS/IML):
http://support.sas.com/documentation/cdl/en/imlug/59656/HTML/default/viewer.htm#langref_sect206.htm
For base SAS you can refence this previous post:
What I am looking for is the ak one. Multiplying different number
I'm not familiar with SAS having a multiplication function, unless you are actually referring to a factorial (i.e., !) for which there is the fact() function. Of course, you could always roll your own, e.g.:
data want;
input x1-x6;
array nums(*) x1-x6;
mult=nums(1);
do i=2 to dim(nums);
mult=mult*(1+(nums(1)/nums(i)));
end;
cards;
1 2 3 4 5 6
;
Why not use the GEOMEAN function and then convert it to the product using power operator?
product = geomean(of x1-x3) ** n(of x1-x3);
proc fcmp outlib=work.funcs.math;
function capital_pi(nums
mult=nums[1];
do i=2 to dim(nums);
mult=mult*(1+(1/nums));
end;
return(mult);
endsub;
test=capital_pi(1,2,3,4,5,6);
put test=;
run;
%let cmplib=%sysfunc(getoption(cmplib));
options cmplib=(work.funcs);
data _null_;
input x1-x6;
array x[6];
array nums[6] _temporary_; *Array parameters to subroutine calls must betemporary arrays.;
do i=1 to 6;
nums=x;
end;
product=capital_pi(nums);
put product=;
cards;
1 2 3 4 5 6
;
run;
options cmplib=&cmplib;
Result is 3.5
See http://www.sascommunity.org/wiki/Computing_Products
iusing wrote:
As the title, what is the sas function of ∏?
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.