I've put together the proc report code shown below. As you will see I'm attempting to make several values listed in the report into links via compute blocks. The urls include two values from the data set being used in the report: site and logop. This works great in the first row of the report. In subsequent rows the links get set up but the logop value is missing from the url every time! Both the site and logop variables appear in every row of the data set being used. Site shows up in the every url as expected. Any ideas how to fix this?
Consider the following output:
Region showreg Product Total Sales
Asia Asia Boot 62,708
Asia Men's Casual 11,754
Asia Men's Dress 119,366
Asia Sandal 8,208
Asia Slipper 152,032
Asia Sport Shoe 2,092
Asia Women's Casual 25,837
Asia Women's Dress 78,234
Asia Asia 460,231
The above report shows how PROC REPORT suppresses the duplicate or repetitive values for a GROUP variable (REGION) in the first column on the report. By default, only the first occurence of a group and any summary line will contain the GROUP variable value. That means the value for REGION is blank or suppressed on ALL the other report rows for the group. This is a little favor that PROC REPORT does for you, which in your case, is giving you what you want for the first report row, but NOT what you want on the subsequent report rows.
So, you have to "grab" and save the region value at the beginning of the group. You can do this in a compute block -- that's how I made the SHOWREG column. It is likely that a technique like this would allow you to build your url string in a compute block.
The code that created the above output is shown below.
proc sort data=sashelp.shoes out=shoes;
by region product;
where region in ('Asia','Canada', 'Pacific');
proc report data=shoes nowd;
column region showreg product sales;
define region /group f=$8.;
define product / group f=$15.;
define showreg / computed f=$8.;
define sales / sum f=comma12.;
break after region / summarize skip;
compute before region ;
** grab the region on the first of the group;
holdreg = region;
compute showreg / character length=15;
showreg = holdreg;
Thanks Cynthia! This pretty much worked. The weird thing is if I add in a compute block to hold the value of the logop variable and try to use it in the urlstring it still doesn't work. When I use a computed item similar to your 'showreg' example the logop both prints and appears correctly in the urlstring. So I ended up using a computed item, show_logop, with a noprint. That gets me the result I wanted! Revised code is below, in case it might help others: