Folks,
I have been computing mean and medians using the following statement.
proc summary data = Quantity_of_Properties_1 nway completetypes;
;
format class $class. year_filed year_filed. county_y $county_y. child_filed $child_filed.;
class class year_filed county_y child_filed/mlf;
var realprice1;
output out = Table_0_fil (drop=_TYPE_ /*_freq_*/)
median= med_price mean=mean_price;
run;
However, I would like to compute the geometric mean, but I understand I can only do it through proc surveymeans. Is there anyway to get the same kind of output as above with proc surveymeans?
I've tried to the following but it does not work so any help would be great.
PROC SURVEYMEANS data=prices geomean;
format class $class. year_filed year_filed. county_y $county_y. child_filed $child_filed.;
class class year_filed county_y child_filed;
var realprice1;
ods output statistics=i;
run;
PROC UNIVARIATE also can also be used -- see this article. And the TTEST procedure.
Thanks for this. It doesn't look like proc univariate can handle multi level formats though or am I incorrect on this?
Try a two-step process. First, log transform realprice1 in a DATA step (for illustration purposes, let's call it lnrealprice1). Then feed it through PROC SURVEYMEANS just as you have the untransformed value. Finally, using the output dataset, exponentiate the mean, SD, confidence bounds, etc. Make sure that you include the sampling weights in the PROC SURVEYMEANS call, using either the WEIGHTS or REPWEIGHTS statement.
Thanks go to @PeterClemmensen and @ChrisHemedinger for the referral to Rick Wicklin's ( @Rick_SAS ) blog.
SteveDenham
Hi Steve,
It appears that surveymeans can't handle multilevel formats either. For instance, proc summary /mlf option works, but this doesn't appear to be the case with the other functions.
Would I be correct in this assumption?
@Sean_OConnor wrote:
Hi Steve,
It appears that surveymeans can't handle multilevel formats either. For instance, proc summary /mlf option works, but this doesn't appear to be the case with the other functions.
Would I be correct in this assumption?
You really should have defined in your initial question that the groups were defined by a multilabel format, if that is what you mean by "multilevel". Most formats are "multilevel" unless you are mapping all values to a single one. The documentation for Multilabel has the procedures that support the feature.
To use SURVEYMEANS you would make additional DOMAIN variables for each level and use a DOMAIN statement such as:
domain Level1 Level1*Level2; to get the combined mean of Level1 and Level2 plus an overall for each Level1 value.
You could also make a temporary dataset with a new variable equal to the log10(realprice1) or log(realprice1), followed by proc summary with the class statements you want, and adding the new variable to the var statement.
Then take the output dataset TABLE_0_FIL produced by the proc summary, and get the antilog (either 10**x or exp(x)) of the mean of the new variable. You will have the desired subgroup geometric means alongisde the other stats you requested.
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.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.