BookmarkSubscribeRSS Feed
mitrakos
Obsidian | Level 7

Hello! This is a bit difficult to explain so I will try my best, please let me know if you need any more info than I give below. 

 

I am looking at blood pressure data that spans months of time, from ~October 2019 to ~August 2020. I am trying to see how many days per week people on average took their blood pressure. However, there are multiple periods that are not full weeks (When they got their monitor, different cutoff points, etc.), and I am aiming to convert them into their full week counterpart. For example, if someone took their blood pressure 3 days out of the 4 they had it on their first week, I would want it to be converted into 5 days out of a full 7 day week (5.25 rounded down). 

 

Is there any way to reliably do this in SAS? I'm a bit confused as to how to go about it. Thank you for reading!

 

Best,

Adam

3 REPLIES 3
Shmuel
Garnet | Level 18

Clarification is needed:

1) Is the date variable is a sas numric-date variable?

2) Do you mean by "week" a period of any 5 days? or relating to a week

    as (from Sunday to Thursday) or (Monday to Friday) ? 

 

In order to count days in a week I propose to compute a temporary variable week_seq

something like:

week_seq = catx('-', year(date), week(date));

then you can run proc freq on week_seq.

mitrakos
Obsidian | Level 7
Yes, the date is in date9 format and is then converted into weeku6 format, which is Sunday - Saturday
Shmuel
Garnet | Level 18

What is the answer to my 2nd question:

2) Do you mean by "week" a period of any 5 days?

 

Suppose there are dates from 1 to 10 in a month. Are those two periods 1-5 and 6-10

or 1-7 counting only 5 days: (Sunday to Thursday) or (Monday to Friday) ?

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 443 views
  • 0 likes
  • 2 in conversation