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 ∏?
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.