BookmarkSubscribeRSS Feed
shadowgun1102
Calcite | Level 5

Hello everyone

Is it possible to calculate percent from total in proc means ?

Thanks!

3 REPLIES 3
andreas_lds
Jade | Level 19

Afaik not, but i am to lazy to look in the docs.

 

The docs can be found at https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=pgmsashome&docsetTarget=h...

 

proc tabulate can do this :

proc tabulate data=sashelp.class;
   class Sex;
   var Age;

   table Sex, Age*pctsum;
run;
ballardw
Super User

@shadowgun1102 wrote:

Hello everyone

Is it possible to calculate percent from total in proc means ?

Thanks!


The exception to @andreas_lds's response is a variable that is coded with only 1 and 0 values. The mean would be the "percent of 1's" for the records with values expressed in  decimal form: .456 as the mean would be equivalent to 45.6%.

Ksharp
Super User
proc sql;
select name,weight,weight/(select sum(weight) from sashelp.class) as percent format=percent8.2
 from sashelp.class;
quit;

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 16. 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
  • 966 views
  • 0 likes
  • 4 in conversation