Write a code that produces the SUM of Salary corresponding to Male and Female . Create a data in name of SUM_Report.
give me some hints for this question
A small example to get you started on the syntax
proc means data=sashelp.baseball sum;
class team;
var salary;
output out=Salary_Sums sum=sum;
run;
Though, the best starting point is the PROC MEANS Documentation.
To start, you will need to read the documentation on PROC MEANS:
Here are some of the items you will need to focus on.
You need to know the names of the variables in your data set, as well as the name of the data set itself. All of those need to be inserted into your program in the proper place.
The easiest way to get what you need is to sort your data set, and use a BY statement after that within PROC MEANS. To get separate statistics for Male and Female, the variable that takes on values of "Male" or "Female" will be your BY variable.
The name of your data set goes on the PROC statement.
The name of your output data set goes on the OUTPUT statement. You'll need to refer to the documentation for some of the details, like how do you specify what variable name should be used to hold the sum.
If you try it, you'll almost certainly make progress. If you get stuck, post what you did and where you got stuck.
A small example to get you started on the syntax
proc means data=sashelp.baseball sum;
class team;
var salary;
output out=Salary_Sums sum=sum;
run;
Though, the best starting point is the PROC MEANS Documentation.
@Abhau wrote:
thank you .
but in proc means it doesn't take an alphabetical variable . the name of variable (Gender) in gender all the observations are male female but it is written like( M F)
it is not showing result
Show the code and any messages from the log. Copy from the log and paste into a code box opened using the forum's {I} icon.
The CLASS statement in Proc Means will take "alphabetical" variables. The BY statement will take "alphabetical" variables. The VAR, FREQ and WEIGHT statements will not take "alphabetical" variables.
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!
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.