BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
hussainstat
Calcite | Level 5
  1. You are given a table that lists out one row per month in which a member is actively enrolled in a commercial insurance plan in 2018 (excerpt shown below). Each member can contribute between 1 to 12 months in this table, and they can contribute any specific calendar months within the year

Table 1.

MemberID

YearMo (member month)

100001

201801

100001

201802

100001

201803

100002

201801

100002

201802

100003

201807

100003

201808

100003

201809

100003

201810

……

……

a.Write code to output a new table from Table 1 that includes all of the observations for members with a member month in January 2018. Hint: YearMo is a character variable.

b.Write code to output a new table from Table 1 that has one row per member and the count of each member’s member months. Include a depiction of what you would expect this table to look like based on the sample shown above.

c.Write code to output a new table from Table 1 that has one row for each month in 2018 and counts the number of members who are active in that month. Include a depiction of what you would expect this table to look like based on the sample shown above.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Please include anything you've tried. 

Given the framing of the question it seems like homework or a test, so showing what you've tried first will allow us to gauge the level of answers required and most prefer to help with homework than provide full answers.

 

 


@hussainstat wrote:
  1. You are given a table that lists out one row per month in which a member is actively enrolled in a commercial insurance plan in 2018 (excerpt shown below). Each member can contribute between 1 to 12 months in this table, and they can contribute any specific calendar months within the year

Table 1.

MemberID

YearMo (member month)

100001

201801

100001

201802

100001

201803

100002

201801

100002

201802

100003

201807

100003

201808

100003

201809

100003

201810

……

……

a.Write code to output a new table from Table 1 that includes all of the observations for members with a member month in January 2018. Hint: YearMo is a character variable.

b.Write code to output a new table from Table 1 that has one row per member and the count of each member’s member months. Include a depiction of what you would expect this table to look like based on the sample shown above.

c.Write code to output a new table from Table 1 that has one row for each month in 2018 and counts the number of members who are active in that month. Include a depiction of what you would expect this table to look like based on the sample shown above.


 

View solution in original post

2 REPLIES 2
ballardw
Super User

What have you tried that did not work?

What were the actual results of your attempt?

 

Hints:

Create an actual date value from the YearMo variable that allows use of DATE related functions

 

Does your instructor use table to mean "data set", used for further manipulation, or a "report table" that people read? B and C can be done in report procedures like Proc Report or Tabulate depending on desired appearance.

Reeza
Super User

Please include anything you've tried. 

Given the framing of the question it seems like homework or a test, so showing what you've tried first will allow us to gauge the level of answers required and most prefer to help with homework than provide full answers.

 

 


@hussainstat wrote:
  1. You are given a table that lists out one row per month in which a member is actively enrolled in a commercial insurance plan in 2018 (excerpt shown below). Each member can contribute between 1 to 12 months in this table, and they can contribute any specific calendar months within the year

Table 1.

MemberID

YearMo (member month)

100001

201801

100001

201802

100001

201803

100002

201801

100002

201802

100003

201807

100003

201808

100003

201809

100003

201810

……

……

a.Write code to output a new table from Table 1 that includes all of the observations for members with a member month in January 2018. Hint: YearMo is a character variable.

b.Write code to output a new table from Table 1 that has one row per member and the count of each member’s member months. Include a depiction of what you would expect this table to look like based on the sample shown above.

c.Write code to output a new table from Table 1 that has one row for each month in 2018 and counts the number of members who are active in that month. Include a depiction of what you would expect this table to look like based on the sample shown above.


 

sas-innovate-white.png

🚨 Early Bird Rate Extended!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Lock in the best rate now before the price increases on April 1.

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
  • 2 replies
  • 732 views
  • 0 likes
  • 3 in conversation