Chuck
I assume you have many variables and many observations to process. So transposing the data and using the SAS function HARMEAN would be impractical. Imagine transposing a data set with millions of rows!.
This isn't the most elegant solution but it gets the job done. With a little work I am confident that you can come up with an elegant solution for you specific problem.
I tried to mimic the harmean function in SAS. In the SAS documentation if any value is negative then the result is missing. And missing values need to be ignored.
data one;
input x;
datalines;
.
4
12
24
;
run;
data two;
set one end=eof;
if x <0 and not missing(X) then negative_flag+1;
x1=1/x;
cum_x+x1;
n+1;
if missing(x) then n=n-1;
if eof and not negative_flag then do;
x_harmonic_mean=1/(cum_x/n);
put x_harmonic_mean;
end;
run;
data _null_;
x2=harmean(.,4,12,24);
put x2=;
run;
-Darryl