Hello,
How can I easily produce a chart of the number of observations that occurred per week based on a date field on each observation over the previous 3 months from a parameter date?
Specifically, I am wondering if there is a proc which can do most of the work of this, where you give it a dataset with the dates and it then clusters the number of observations by week, going back a specified number of intervals (in this case 3 weeks) and then produces a table or chart.
Kind regards,
Mark
If date and parmdate are SAS dates, you can use
weeks = intck("WEEK", date, parmDate, "Continuous")
to get the number of weeks between date and parmDate.
Please post example data, the expected result and a value the parameter date contains.
It seems that you need a where-statement to get the observations of the 3 month before param_data. Assuming that the parameter contains the string 9Sep2018 (value taken from EG prompt): where data_date >= intnx('month', "&promptDate."d, -3, 's')
To get the number of observations per week, applying a format like weekv5 and using a proc like summary or freq could yield the required result. But without any data shown, this is pure guesswork.
@markc wrote:
Hello,
How can I easily produce a chart of the number of observations that occurred per week based on a date field on each observation over the previous 3 months from a parameter date?
Kind regards,
Mark
How does the "parameter date" get involved? Is that used to filter data or indicate the first day of a "week" and calculate weeks based on seven day intervals from the parameter of something else? By previous 3 months do you mean from the first day of the month 3 previous or go back to the same day of the month 3 previous?
And which day of the week starts your week?
How do you want "week" interpreted if your period crosses year boundaries?
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.