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

"Create a frequency table of current gender and sexual orientation for patients between the age of 18 - 50 years" was my instructions...I want to know if my output is correct. Please see attachment. 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Typically when a phrase like "between the age of 18 - 50 years" is used then the data should be subsetted to that range, typically with a Where statement or data set option. Your frequencies for Age don't show any ages outside that range so go so far.

 

However you apparently have multiple "gender" variables and we have no way of knowing which is the "current" value. From the request, that is the only one that should be used.

Since the request says "a frequency table of current gender and sexual orientation " I would normally interpret that as meaning first, one table, not 6 plus and graphs, and second that you have gender and orientation in a single table. If race is not part of the request do not include it, if required then describe how race is supposed to be included.

 

In Proc Freq that would be a Tables statement like: Tables genderc*sex_o;

 

With the stated requirement and the shown output, if I were grading this as an assignment it would likely get a D because no where do you have gender and orientation together.

 

If the requirement does not want graphs then turn of the graphs before running proc freq.

View solution in original post

1 REPLY 1
ballardw
Super User

Typically when a phrase like "between the age of 18 - 50 years" is used then the data should be subsetted to that range, typically with a Where statement or data set option. Your frequencies for Age don't show any ages outside that range so go so far.

 

However you apparently have multiple "gender" variables and we have no way of knowing which is the "current" value. From the request, that is the only one that should be used.

Since the request says "a frequency table of current gender and sexual orientation " I would normally interpret that as meaning first, one table, not 6 plus and graphs, and second that you have gender and orientation in a single table. If race is not part of the request do not include it, if required then describe how race is supposed to be included.

 

In Proc Freq that would be a Tables statement like: Tables genderc*sex_o;

 

With the stated requirement and the shown output, if I were grading this as an assignment it would likely get a D because no where do you have gender and orientation together.

 

If the requirement does not want graphs then turn of the graphs before running proc freq.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 1 reply
  • 765 views
  • 0 likes
  • 2 in conversation