Hi all,
I have struck a problem and need your help.
I have a dataset with Date, Index, Month, Year, Name_Code, ID, ID_Name, Value.
Date is just a month and year which have been translated into the variables Month & Year.
Index represents a block of date range that is the same date range all the way through the dataset. (Repeated every time the index is incremented)
Now, I have lots of blank space in between the Index. At some point I will have a value for Name_Code, ID, ID_Name, Value contained within the index. This will then need to be used to fill white space within the index. Now the difficulty is that there is sometimes more than one full observation within the index (100+) that will need to fill the white space until another full observation or until the end of the index.
Any help would be greatly appreciated.
| Have: | |||||||
| Date | Index | Month | Year | Name_Code | ID | ID_Name | Value |
| Jan-03 | 1 | 1 | 2003 | . | . | ||
| Feb-03 | 1 | 2 | 2003 | . | . | ||
| Mar-03 | 1 | 3 | 2003 | . | . | ||
| Apr-03 | 1 | 4 | 2003 | John | 45 | Teacher | 101 |
| May-03 | 1 | 5 | 2003 | . | . | ||
| … | |||||||
| Jan-03 | 2 | 1 | 2003 | . | . | ||
| Feb-03 | 2 | 2 | 2003 | Bill | 98 | Engineer | 76 |
| Mar-03 | 2 | 3 | 2003 | Bill | 98 | Engineer | 80 |
| Apr-03 | 2 | 4 | 2003 | . | . | ||
| …. | |||||||
| Want: | |||||||
| Date | Index | Month | Year | Name_Code | ID | ID_Name | Value |
| Jan-03 | 1 | 1 | 2003 | John | 45 | Teacher | 101 |
| Feb-03 | 1 | 2 | 2003 | John | 45 | Teacher | 101 |
| Mar-03 | 1 | 3 | 2003 | John | 45 | Teacher | 101 |
| Apr-03 | 1 | 4 | 2003 | John | 45 | Teacher | 101 |
| May-03 | 1 | 5 | 2003 | John | 45 | Teacher | 101 |
| … | |||||||
| Jan-03 | 2 | 1 | 2003 | Bill | 98 | Engineer | 76 |
| Feb-03 | 2 | 2 | 2003 | Bill | 98 | Engineer | 76 |
| Mar-03 | 2 | 3 | 2003 | Bill | 98 | Engineer | 80 |
| Apr-03 | 2 | 4 | 2003 | Bill | 98 | Engineer | 80 |
How do you fill this?
| Jan-03 | 2 | 1 | 2003 | . | . | ||
| Feb-03 | 2 | 2 | 2003 | Bill | 98 | Engineer | 76 |
| Mar-03 | 2 | 3 | 2003 | ||||
| Apr-03 | 2 | 4 | 2003 | . | . |
| May-03 | 2 | 5 | 2003 | . | . | ||
| Jun-03 | 2 | 6 | 2003 | ||||
| Jul-03 | 2 | 7 | 2003 | Bill | 98 | Engineer | 80 |
| Aug-03 | 2 | 8 | 2003 | . | . |
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.