Hi all,
I am trying to calculate "Geom CV (%)" for one of my table as below:
geo_std=exp(a_std); -> Geometric Standard Deviation
log_geo_std=log(geo_std); -> log of Geometric Standard Deviation
geo_cv=sqrt(exp(log_geo_std**2)-1)*100; -> Geom CV (%)
Is this correct code for "Geom CV (%)"? please confirm.
Please let me know if you want more details.
Thanks,
Adi
See this older thread on the same topic.
Hi all,
my code works well here.
Thanks,
Adithya
@chinna0369 Please mark one of the answers as correct, not your own response.
Hi Reeza,
Yes, the reason I used mine as answer is my code is giving correct results so if anyone can see this post then they can use the code.
Please let me know if I am wrong.
Thanks,
Adi
@chinna0369 wrote:
Hi Reeza,
Yes, the reason I used mine as answer is my code is giving correct results so if anyone can see this post then they can use the code.
Please let me know if I am wrong.
Thanks,
Adi
1. Your answer includes no code so no one can use the information here to provide the correct answer
2. If you're referring to the code in your initial post, then that is incorrect, that is not the correct method to get the GEOM CV(%) as per the links Rick has included.
Below is the code I have used for my results and it works well.
** First fidn out Means;
proc means data=dsn;
by trt01an;
var AVAL_1;
output out=geo_stats1 n=a_n mean=a_mean std=a_std median=a_median q1=a_q1 q3=a_q3 min=a_min max=a_max;
run;
** then Geo stats;
data geo_stats2;
set geo_stats1;
geo_mean=exp(a_mean);
geo_std=exp(a_std);
log_geo_std=log(geo_std);
geo_cv=sqrt(exp(log_geo_std**2)-1)*100;
run;
Yes, I am taking the log of original variable.
Thanks,
Adi
Yes, if I don't take the exp std two times then I am getting different values.
Thanks,
Adi
This is the complete solution from starting then:
data chk1;
set chk;
if var not in (. 0);
var_1=log(var);
run;
proc sort; by trt; run;
** Means;
proc means data=chk1;
by trt;
var var_1;
output out=geo_stats1 n=a_n mean=a_mean std=a_std median=a_median q1=a_q1 q3=a_q3 min=a_min max=a_max;
run;
** Geo stats;
data geo_stats2;
set geo_stats1;
geo_mean=exp(a_mean);
geo_std=exp(a_std);
log_geo_std=log(geo_std);
geo_cv=sqrt(exp(log_geo_std**2)-1)*100;
run;
data geo_stats3;
set geo_stats2;
geom_meansd=strip(put(geo_mean,8.3))||"("||strip(put(geo_std,8.4))||")";
geo_cv_=strip(put(geo_cv,8.2));
ord=3;
keep trt01an geom_meansd geo_cv_ ord;
run;
sorry for so many replies. I will be more clear from next time.
Thanks,
Adi
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.