When PROC REPORT builds a report using ACROSS variables, it assigns absolute column numbers (such as _C2_, _C3_, _C4_) to each column that is underneath an ACROSS item. That means in your COMPUTE block that you cannot refer to the YR_MONTH variable by name, you would instead need to refer to the absolute column numbers. And, further, the value of _C2_, _C3_, etc would NOT be the value of YR_MONTH, but would, instead, be the value of REC_COUNT for that particular YR_MONTH. So, you'd have to use the absolute column number a different way.
Another alternative would be to set the URL in the header, with a user-defined format (as shown in #2) -- this doesn't get ProcessID into the URL, though, I just offer it as a possible alternative approach.
Also, remember that if you are using this code to invoke a SAS Stored Process using SASStoredProcess/do? that not every client application may be able to receive HTML streaming results from invoking a URL. Just FYI.
Thank you for your insights and explinations of the compute block. This solution gets me there with a defined set of input. Unfortunately I did not mention that the data would change and I appologize for that. So with that knowledge I built upon your solution along with some input from another SAS Paper that I found (Alison McMahill http://support.sas.com/rnd/papers/sgf07/sgf2007-report.pdf) to come up with a solution to take data from any time frame and build the link dynamically.
The solution involves a little macro code and some other SQL code. First I create a dataset with the Yr_Months. Then you need to know the number of months that are in the data. Then I put the Yr_months into macro variables for later use. Once you have that then you can use a loop to reference the ABSOLUTE column reference as you described.
So here's another way to do it:
proc sql noprint;
create table mnths as
select distinct Yr_Month
order by Yr_Month
select count(1) into :Mnth_cnt
select Yr_Month into :Mnth1-:Mnth%eval(&Mnth_cnt)
Another thing I noticed was in your reply you mention that not all clients might be able to receive streaming html results from a url... which leads me to the question: What's the prefered way to build summary reports that can drill down to the detail for consumption on the web (SAS Information Delivery Portal or SAS Web Report Studio) or maybe even SAS Add-In for MS?
About your other question about drilling down and the Platform. Most drill-down from a summary level down to a detail level is done mostly with OLAP cubes.
But, you can implement drill-down on the platform. For example, there are some examples of doing drill-down in the Stored Process Web Application (SPWA) samples. And, for information about creating drill-down URLs in the various client applications, you may want to refer to the Stored Process developer documentation. In addition, you may want to look in the Stored Process and Web Report Studio forums, where the topic comes up frequently.
It is useful, to me, to remember that the URL is a fairly specific construct. The anchor tag and the hyperlink it produces were designed by the W3C for use in a browser. So, if you were coding a stored process to be returned to a web browser, such as the Information Delivery Portal and the Stored Process Web Application (SPWA), then such anchor tag coding as _SELF for the href target might be OK; but that same anchor tag coding may not be an attribute that is respected by non-browser client applications. For example, what about Microsoft Word??? A client application like Word or Excel or PowerPoint may or may not allow drill-downs such as you envision.
And if drill-down control does work, where do you envision the drill-down happening -- for example -- a person has Word open, they run a stored process in Word and the stored process contains a drill-down hyperlink. When the person clicks on the hyperlink, would they get taken to a BROWSER window or would you envision the drilldown returning their results to Word????
As I said, I can envision this working if you were talking about a browser-based client, such as the Portal or the Stored Process Web App. The most common way to implement drill-down capability such as you describe is usually through OLAP cube drill-down. However, drill-down is possible with WRS -- searching on the forums and in the doc and opening a track with Tech Support will be your best resources.