I'm currently working on SAS enterprise to create some predicting datasets where the dates overlap but don't want to overwrite the overlapping data for example
Header 1 | Jan | Apr | Jul | Oct | |||
---|---|---|---|---|---|---|---|
Jan | 0 | ||||||
Feb | 1 | ||||||
Mar | 2 | ||||||
Apr | 3 | 0 | |||||
May | 4 | 1 | |||||
Jun | 2 | ||||||
Jul | 3 | 0 | |||||
Aug | 4 | 1 | |||||
Sept | 2 | ||||||
Oct | 3 | 0 | |||||
Nov | 4 | 1 | |||||
Dec | 2 |
I want to make a new prediction every quarter with the newest data and compare with the prediction made using the previous data. So the effectivedates will overlap but I don't want the data to be overwrittern each time which happens when using effectivedates. I believe I can do this using do loops but am not completely sure how. Any advice on what code to use would be greatly appreciated!!
I do not know what kind of analytics and predictions you want to go for.
Is Organizing the data different an option? The time intervals are different, but you prediction looks the be monthly based.
Changing form qtr runs to monthly runs still be possible, may be to be added as missings. Shifting values in an array should give new diiference columns.
val-0 prdct-mnd1 prdct-mnd2 pdrct-mnd3 prdtc mnd4
qtr-01
qtr-02
qtr-03
qtr-04
qtr-05
qtr-06
I need an individual prediction for each month which is the issue so can't just group them as a quarter. Could I still use arrays if I kept it in the month format do you think? Thanks
Is this data to be store prediction between years as well, or is it a fixed matrix?
To make this flexible transpose the data to 3NF:
month pred_month pred_seq
Jan Jan 0
Feb Jan 1
Mar Jan 2
Apr Jan 3
May Jan 4
Apr Apr 0
May Apr 1
etc
AliceRose,
Welcome to the community! I think that is on the right track for your solution. By normalizing the data to have one record for each Date/PredictionDate combination, you provide yourself with more flexibility for comparisons between predictions and with actuals, when you have them. I'll add that it can be an advantage to format your date values as actual SAS dates, so you can use SAS date functions and features like SERIES plots to visualize your results.
Here's an example with your data. The DATE column is the date-of-prediction (your quarter), PREDMONTH is the month being predicted, and of course PREDICTION is your prediction value.
The resulting plots for your sample data (just placeholders, I know) aren't too informative, but if you apply your real data you might find these plots useful. And they are easy to enhance with useful legends, axis behaviors, and more.
Chris
The idea is you have an individual prediction for each month. The switch is not trying to use absolute references as you did, but as a relative offset to each records identification.
By that every record will get a consistent logical meaning that is far more extentsible to every period.
I agree on the direction for a 3NF approach Third normal form - Wikipedia, the free encyclopedia it must be also in a 1nf First normal form - Wikipedia, the free encyclopedia that states there must be some atomicity. The atomicity is not having a absolute meaning. It depends on what you are defining as the most elementary way for storing the data as a dwh approach. There are more valid solutions for that.
(see criticism)
Do not expect the data to be ready able to run directly. You often will need to transform the data to be fit on what a ots (off the shelf) procedure is expecting.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.