- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I rarely use proc report but now I need to and I can't figure out how to write this...
I have a report that needs to show number of registrations per month for months that fall within a set timeperiod.
There are some grouping variables and then the months (only the ones where there is at least one registration) as columns and then two summary columns.
The first should calculate the number of registrations (for each group) that falls within the timespan.
The second should calculate the same + the number of registrations that fall outside of the timespan (for each group). The registrations outside the timeperiod don't have a month-value.
My thinking so far:
In order to first sum the columns except for the "outside timespan" I think I need to have "outside timespan" first and summarize all the columns that come after it (as the number of "inside" columns are dynamic).
Then I create another summary column that starts with the "outside" column first and sums up all columns that comes after it (only then the first summary column is also included so I have to deduct that from the total.
Below is some sample code.
With parts of the code commented I get the correct result in the "ouside timespan" column according to the input data. One registration for group 1A-2F-3K and one for group 1B-2J-3R
However when I try to do an across efter the "ouside" column with the "inside" columns below it... The values for the "outside" column disappears and both summary columns show the same value (when the second should show more registrations).
The "outside" column is only in the report for calculating the second summary column... It's shouldn't be visible in the final report...
Any tips on what I'm doing wrong or how to solve it another way would be greatly appreciated.
/Andreas
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Can you show what the report is supposed to actually look like given that example data? Complex descriptions really call for a shown result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can see what it’s supposed to look like by changing those two missing values to some dates.
However, when I run the same code with production data there is nothing in any of the two summary columns...
Real data has 18000 registrations within the timeframe and around 211000 outside the timeframe... Can't really understand why it works with test data but not a larger dataset.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The reason I didn't get anything in my summary columns was that the "inside" columns started at _C256_!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
So the sums should be like this: