BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
chinaski
Obsidian | Level 7

i really can't understand why proc means don't have gmean option, i want to find all things one side, if anybody knows is there a way please answer, otherwise you can shut up for your smart ass comments.

1 ACCEPTED SOLUTION

Accepted Solutions
Oligolas
Barite | Level 11

Hi,

there is a way but why don't you simply use surveymeans??

PROC SURVEYMEANS data=sashelp.class geomean;
 var age;
run;

if you still want to use proc means, proceed like this:

DATA class1;
 set sashelp.class;
 ln_age=log(age);
run;

PROC MEANS data=class1 mean stddev;
 var ln_age;
 output out=class2means mean=a_mean stddev=a_stddev;
run;

DATA class3;
 set class2means;
 geo_mean=exp(a_mean);
 geo_stddev=exp(a_stddev);
run;

PROC PRINT data=class3 noobs;
 var geo_mean geo_stddev;
run;

 

________________________

- Cheers -

View solution in original post

3 REPLIES 3
Oligolas
Barite | Level 11

Hi,

there is a way but why don't you simply use surveymeans??

PROC SURVEYMEANS data=sashelp.class geomean;
 var age;
run;

if you still want to use proc means, proceed like this:

DATA class1;
 set sashelp.class;
 ln_age=log(age);
run;

PROC MEANS data=class1 mean stddev;
 var ln_age;
 output out=class2means mean=a_mean stddev=a_stddev;
run;

DATA class3;
 set class2means;
 geo_mean=exp(a_mean);
 geo_stddev=exp(a_stddev);
run;

PROC PRINT data=class3 noobs;
 var geo_mean geo_stddev;
run;

 

________________________

- Cheers -

chinaski
Obsidian | Level 7

Hi Oligolas,
Thank you for your answer, i simply can't understand why they did not put gmean option in proc means.
i have a code like this:
proc means data=WORK.datasetv02 n mean median maxdec=2;
var product_price;
class /*web_site*/ search_key product_name product_code month;
output out = work.datasetv03 (drop=_type_ _freq_) n= Toplam_Fiyat_Sayısı mean = Ortalama median = Medyan ;
FORMAT ortalama 16.2 ;
ways 4;
run;
So in here i do not only get results but a new table, now i have to do separate operations in separate tables.
Anyway i will use what you recommend but does proc surveymeans function just like proc means?
In proc means we can have output in any number of ways and thats perfect, but in proc surveymeans it doesn't work.
Thank you again.

Ksharp
Super User

Use proc univariate instead.

proc univariate data=sashelp.heart outtable=want noprint ;
var height weight;
run;

Check WANT dataset.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2040 views
  • 2 likes
  • 3 in conversation