BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Ossy
Calcite | Level 5

I need assistance in calculating the proportion of females in this dataset

 

ID

1

SEX

1

height_feet

5

heaight_inch

4.5

Weight 

138

Systolic 

117

Diastolic 

82

Glucose

98

Cholesterol

168

2152.5201.612290102201
3258.5206.21286897197
4252.51211448490211
5151229.21308694168
6255.5236.21268892232

Female is 1, Male is 2.

What proportion of the sample is female?

3. What is mean, median, std minimum, maximum, and range for weight, systolic, diastolic, glucose and cholesterol, answers must be 1 decimal place. 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Proc freq one-way frequency tables give count and percentage (and cumulative count and percentages)

 

Since you didn't provide an actual data set or data step to create such I'll use a data set SAS provides that has a Sex variable to demonstrate. The variable in the data set is character but the behavior would be the same.

 

proc freq data=sashelp.class;
   tables sex;
run;

with output like

Sex Frequency Percent Cumulative
Frequency
Cumulative
Percent
F 9 47.37 9 47.37
M 10 52.63 19 100.00

or 47.37 percent of the observations are from Females.

 

If you actually have two questions the Proc Means with the MAXDEC= (maximum number of decimals ) option would likely be easiest:

proc means data=sashelp.class maxdec=1
   mean median stddev min max range;
run;
   

By default Proc Means will summarize all numeric variables. If you want specific variables then provide them on a VAR statement with the list of variable names of interest.

View solution in original post

2 REPLIES 2
ballardw
Super User

Proc freq one-way frequency tables give count and percentage (and cumulative count and percentages)

 

Since you didn't provide an actual data set or data step to create such I'll use a data set SAS provides that has a Sex variable to demonstrate. The variable in the data set is character but the behavior would be the same.

 

proc freq data=sashelp.class;
   tables sex;
run;

with output like

Sex Frequency Percent Cumulative
Frequency
Cumulative
Percent
F 9 47.37 9 47.37
M 10 52.63 19 100.00

or 47.37 percent of the observations are from Females.

 

If you actually have two questions the Proc Means with the MAXDEC= (maximum number of decimals ) option would likely be easiest:

proc means data=sashelp.class maxdec=1
   mean median stddev min max range;
run;
   

By default Proc Means will summarize all numeric variables. If you want specific variables then provide them on a VAR statement with the list of variable names of interest.

Ossy
Calcite | Level 5
Thank you so much for your assistance.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 2 replies
  • 427 views
  • 0 likes
  • 2 in conversation