I hesitate to correct Mathematica, but I thought Harmonic Numbers were only defined for integers. The arguments do not look like integers to me.
I don't think SAS has a built-in function for harmonic numbers. However, the harmonic numbers are just the sum of the reciprocals of integers, so you can define the following function:
proc iml;
start HarmonicNumber(n);
return sum(1/(1:n));
finish;
/* test it: The 10th harmonic number is 7382/2520 */
H = HarmonicNumber(10);
print H[format=FRACT.];
I hesitate to correct Mathematica, but I thought Harmonic Numbers were only defined for integers. The arguments do not look like integers to me.
I don't think SAS has a built-in function for harmonic numbers. However, the harmonic numbers are just the sum of the reciprocals of integers, so you can define the following function:
proc iml;
start HarmonicNumber(n);
return sum(1/(1:n));
finish;
/* test it: The 10th harmonic number is 7382/2520 */
H = HarmonicNumber(10);
print H[format=FRACT.];
SAS INNOVATE 2024
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.