DATA Step, Macro, Functions and more

Building a dataset

Reply
New Contributor
Posts: 2

Building a dataset

[ Edited ]

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 !

Super User
Posts: 11,343

Re: Building a dataset

Posted in reply to VenkatAnalyst

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.

New Contributor
Posts: 2

Re: Building a dataset

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!
Super User
Super User
Posts: 7,988

Re: Building a dataset

Posted in reply to VenkatAnalyst

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.

Ask a Question
Discussion stats
  • 3 replies
  • 339 views
  • 0 likes
  • 3 in conversation