BookmarkSubscribeRSS Feed
VenkatAnalyst
Calcite | Level 5

I have a data set with some student ids and the dates they were in attendance along with the number of classes they had taken on that particular day of attendance. Another data set with all the calendar days are also available. I want to flag those students that have taken more than 6 classes over a rolling 7 calendar day period. The goal is to identify the dates that the student exceeded that threshold, in other words the same student could have met that threshold on multiple dates. Any idea how I would be able to do that?

 

Any help is much appreciated.

 

Thanks !

3 REPLIES 3
ballardw
Super User

It would help to provide some example data and what you would like to see for a final output. You can follow instructions from this link https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... to create datastep code as text to post to the forum to create example data sets we can test code with.

It will help if your dates as SAS date values.

VenkatAnalyst
Calcite | Level 5
Attached is the data set I would like to get as output. However the first 4 columns are already part of the dataset I have. Previous7DayWindow: Represents the dailyclassesTaken field totaled for the previous 7 calendar days not just the data set days Flag: If Previous7DayWindow >=6 then that is set to 1 else 0 newDailyClassesTaken: This value is set to dailyClassesTaken when the prev7Daywindow was greater than 6. That assumes that student does not have the ability to take a class until that cumulative classes taken in a 7 day window decreases below 6. For example. The student after 1May2015 having taken 10 classes needs to be locked out to not be able to take any more classes until they pass the 7 day window and could have taken classes on the 8May2015 next however they did not attend school after the 7th until September. I hope this helps outline the example and what I am trying to get to with this effort. Thanks!
RW9
Diamond | Level 26 RW9
Diamond | Level 26

To get an answer to your question please post:

Example test data, in the form of a datastep - copied and pasted into the text box here so we can run it to get test data.  You can extract this form your data by following the post at:

https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...

 

The post an example - directly into the text box here - of what the output should look like.  Most people will not download random Excel files from the web.  

Finally provide any additional information on what the process is about.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1044 views
  • 0 likes
  • 3 in conversation