- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I have one table having one column Primary Coverage (having 2 observation, but in future their is possible to have more than2 observation)
I want to create a macro to loop through Year, Quarter, month and Column value dynamically, so that my table should look like this: (2000Q1 to 2001Q1= 15 month, 5 Quarters, and 1 Year) (Please answer...its really urgent)
year | quarter | Primary_coverage | months |
2000 | 1 | combined single limit | 3 |
2000 | 1 | combined single limit | 6 |
2000 | 1 | combined single limit | 9 |
2000 | 1 | combined single limit | 12 |
2000 | 1 | combined single limit | 15 |
2000 | 2 | combined single limit | 3 |
2000 | 2 | combined single limit | 6 |
2000 | 2 | combined single limit | 9 |
2000 | 2 | combined single limit | 12 |
2000 | 2 | combined single limit | 15 |
2000 | 3 | combined single limit | 3 |
2000 | 3 | combined single limit | 6 |
2000 | 3 | combined single limit | 9 |
2000 | 3 | combined single limit | 12 |
2000 | 3 | combined single limit | 15 |
2000 | 4 | combined single limit | 3 |
2000 | 4 | combined single limit | 6 |
2000 | 4 | combined single limit | 9 |
2000 | 4 | combined single limit | 12 |
2000 | 4 | combined single limit | 15 |
2001 | 1 | combined single limit | 3 |
2001 | 1 | combined single limit | 6 |
2001 | 1 | combined single limit | 9 |
2001 | 1 | combined single limit | 12 |
2001 | 1 | combined single limit | 15 |
2000 | 1 | uninsured motorist | 3 |
2000 | 1 | uninsured motorist | 6 |
2000 | 1 | uninsured motorist | 9 |
2000 | 1 | uninsured motorist | 12 |
2000 | 1 | uninsured motorist | 15 |
2000 | 2 | uninsured motorist | 3 |
2000 | 2 | uninsured motorist | 6 |
2000 | 2 | uninsured motorist | 9 |
2000 | 2 | uninsured motorist | 12 |
2000 | 2 | uninsured motorist | 15 |
2000 | 3 | uninsured motorist | 3 |
2000 | 3 | uninsured motorist | 6 |
2000 | 3 | uninsured motorist | 9 |
2000 | 3 | uninsured motorist | 12 |
2000 | 3 | uninsured motorist | 15 |
2000 | 4 | uninsured motorist | 3 |
2000 | 4 | uninsured motorist | 6 |
2000 | 4 | uninsured motorist | 9 |
2000 | 4 | uninsured motorist | 12 |
2000 | 4 | uninsured motorist | 15 |
2001 | 1 | uninsured motorist | 3 |
2001 | 1 | uninsured motorist | 6 |
2001 | 1 | uninsured motorist | 9 |
2001 | 1 | uninsured motorist | 12 |
2001 | 1 | uninsured motorist | 15 |
But when i run the same program on 2001Q3 , then my table data should look like this ( 2000Q1 to 2001Q3= 21 month, 7 Quarters and 1 Year) (Please find attached file for same )
year | quarter | Primary_coverage | months |
2000 | 1 | combined single limit | 3 |
2000 | 1 | combined single limit | 6 |
2000 | 1 | combined single limit | 9 |
2000 | 1 | combined single limit | 12 |
2000 | 1 | combined single limit | 15 |
2000 | 1 | combined single limit | 18 |
2000 | 1 | combined single limit | 21 |
2000 | 2 | combined single limit | 3 |
2000 | 2 | combined single limit | 6 |
2000 | 2 | combined single limit | 9 |
2000 | 2 | combined single limit | 12 |
2000 | 2 | combined single limit | 15 |
2000 | 2 | combined single limit | 18 |
2000 | 2 | combined single limit | 21 |
2000 | 3 | combined single limit | 3 |
2000 | 3 | combined single limit | 6 |
2000 | 3 | combined single limit | 9 |
2000 | 3 | combined single limit | 12 |
2000 | 3 | combined single limit | 15 |
2000 | 3 | combined single limit | 18 |
2000 | 3 | combined single limit | 21 |
2000 | 4 | combined single limit | 3 |
2000 | 4 | combined single limit | 6 |
2000 | 4 | combined single limit | 9 |
2000 | 4 | combined single limit | 12 |
2000 | 4 | combined single limit | 15 |
2000 | 4 | combined single limit | 18 |
2000 | 4 | combined single limit | 21 |
2001 | 1 | combined single limit | 3 |
2001 | 1 | combined single limit | 6 |
2001 | 1 | combined single limit | 9 |
2001 | 1 | combined single limit | 12 |
2001 | 1 | combined single limit | 15 |
2001 | 1 | combined single limit | 18 |
2001 | 1 | combined single limit | 21 |
2001 | 2 | combined single limit | 3 |
2001 | 2 | combined single limit | 6 |
2001 | 2 | combined single limit | 9 |
2001 | 2 | combined single limit | 12 |
2001 | 2 | combined single limit | 15 |
2001 | 2 | combined single limit | 18 |
2001 | 2 | combined single limit | 21 |
2001 | 3 | combined single limit | 3 |
2001 | 3 | combined single limit | 6 |
2001 | 3 | combined single limit | 9 |
2001 | 3 | combined single limit | 12 |
2001 | 3 | combined single limit | 15 |
2001 | 3 | combined single limit | 18 |
2001 | 3 | combined single limit | 21 |
2000 | 1 | uninsured motorist | 3 |
2000 | 1 | uninsured motorist | 6 |
2000 | 1 | uninsured motorist | 9 |
2000 | 1 | uninsured motorist | 12 |
2000 | 1 | uninsured motorist | 15 |
2000 | 1 | uninsured motorist | 18 |
2000 | 1 | uninsured motorist | 21 |
2000 | 2 | uninsured motorist | 3 |
2000 | 2 | uninsured motorist | 6 |
2000 | 2 | uninsured motorist | 9 |
2000 | 2 | uninsured motorist | 12 |
2000 | 2 | uninsured motorist | 15 |
2000 | 2 | uninsured motorist | 18 |
2000 | 2 | uninsured motorist | 21 |
2000 | 3 | uninsured motorist | 3 |
2000 | 3 | uninsured motorist | 6 |
2000 | 3 | uninsured motorist | 9 |
2000 | 3 | uninsured motorist | 12 |
2000 | 3 | uninsured motorist | 15 |
2000 | 3 | uninsured motorist | 18 |
2000 | 3 | uninsured motorist | 21 |
2000 | 4 | uninsured motorist | 3 |
2000 | 4 | uninsured motorist | 6 |
2000 | 4 | uninsured motorist | 9 |
2000 | 4 | uninsured motorist | 12 |
2000 | 4 | uninsured motorist | 15 |
2000 | 4 | uninsured motorist | 18 |
2000 | 4 | uninsured motorist | 21 |
2001 | 1 | uninsured motorist | 3 |
2001 | 1 | uninsured motorist | 6 |
2001 | 1 | uninsured motorist | 9 |
2001 | 1 | uninsured motorist | 12 |
2001 | 1 | uninsured motorist | 15 |
2001 | 1 | uninsured motorist | 18 |
2001 | 1 | uninsured motorist | 21 |
2001 | 2 | uninsured motorist | 3 |
2001 | 2 | uninsured motorist | 6 |
2001 | 2 | uninsured motorist | 9 |
2001 | 2 | uninsured motorist | 12 |
2001 | 2 | uninsured motorist | 15 |
2001 | 2 | uninsured motorist | 18 |
2001 | 2 | uninsured motorist | 21 |
2001 | 3 | uninsured motorist | 3 |
2001 | 3 | uninsured motorist | 6 |
2001 | 3 | uninsured motorist | 9 |
2001 | 3 | uninsured motorist | 12 |
2001 | 3 | uninsured motorist | 15 |
2001 | 3 | uninsured motorist | 18 |
2001 | 3 | uninsured motorist | 21 |
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You had a post about this earlier on where solutions were provided. Please don't post test data in the form of Excel files, these are dangerous and should not be downloaded. Post test data - just a few observations, in the format of a datastep, so that we can run it and see what your data looks like. Secondly there is no need for macros here, you can use a datastep with a simple do loop to achieve your goal:
data want; do year=<start value> to <your_value>; do quarter=<start value> to <your_quarter>; <create a record>; output; end; end; run;
To get code closer to your data, post your data as a datastep.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@subrat1 wrote:
I want to create a macro to loop through Year, Quarter, month and Column value dynamically, so that my table should look like this: (2000Q1 to 2001Q1= 15 month, 5 Quarters, and 1 Year) (Please answer...its really urgent)
I posted a solution in your other thread, did you try that, it works perfectly for me.
If it doesn't please explain why. I'm not prepared to spend any more time on this problem if you won't take the time to explain your issue and continue to spam your question everywhere. I also answered your question on SO.