<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: proc report URL help in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-report-URL-help/m-p/11131#M1216</link>
    <description>Hi:&lt;BR /&gt;
  Consider the following output:&lt;BR /&gt;
[pre]&lt;BR /&gt;
  Region    showreg          Product           Total Sales&lt;BR /&gt;
  Asia      Asia             Boot                   62,708&lt;BR /&gt;
            Asia             Men's Casual           11,754&lt;BR /&gt;
            Asia             Men's Dress           119,366&lt;BR /&gt;
            Asia             Sandal                  8,208&lt;BR /&gt;
            Asia             Slipper               152,032&lt;BR /&gt;
            Asia             Sport Shoe              2,092&lt;BR /&gt;
            Asia             Women's Casual         25,837&lt;BR /&gt;
            Asia             Women's Dress          78,234&lt;BR /&gt;
  Asia      Asia                                   460,231&lt;BR /&gt;
                                   &lt;BR /&gt;
  Canada    Canada           Boot                  385,613&lt;BR /&gt;
            Canada           Men's Casual          441,903&lt;BR /&gt;
            Canada           Men's Dress           920,101&lt;BR /&gt;
            Canada           Sandal                 14,798&lt;BR /&gt;
            Canada           Slipper               952,751&lt;BR /&gt;
            Canada           Sport Shoe            140,389&lt;BR /&gt;
            Canada           Women's Casual        410,807&lt;BR /&gt;
            Canada           Women's Dress         989,350&lt;BR /&gt;
  Canada    Canada                               4,255,712&lt;BR /&gt;
                                 &lt;BR /&gt;
  Pacific   Pacific          Boot                  123,575&lt;BR /&gt;
            Pacific          Men's Casual          662,368&lt;BR /&gt;
            Pacific          Men's Dress           426,191&lt;BR /&gt;
            Pacific          Sandal                 48,424&lt;BR /&gt;
            Pacific          Slipper               390,740&lt;BR /&gt;
            Pacific          Sport Shoe             26,169&lt;BR /&gt;
            Pacific          Women's Casual        219,886&lt;BR /&gt;
            Pacific          Women's Dress         399,441&lt;BR /&gt;
  Pacific   Pacific                              2,296,794&lt;BR /&gt;
                              &lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                                                                                     &lt;BR /&gt;
                   &lt;BR /&gt;
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.&lt;BR /&gt;
 &lt;BR /&gt;
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.&lt;BR /&gt;
 &lt;BR /&gt;
The code that created the above output is shown below.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc sort data=sashelp.shoes out=shoes;&lt;BR /&gt;
  by region product;&lt;BR /&gt;
  where region in ('Asia','Canada', 'Pacific');&lt;BR /&gt;
run;&lt;BR /&gt;
                           &lt;BR /&gt;
proc report data=shoes nowd;&lt;BR /&gt;
  column region showreg product sales;&lt;BR /&gt;
  define region /group f=$8.;&lt;BR /&gt;
  define product / group f=$15.;&lt;BR /&gt;
  define showreg / computed f=$8.;&lt;BR /&gt;
  define sales / sum f=comma12.;&lt;BR /&gt;
  break after region / summarize skip;&lt;BR /&gt;
  compute before region ;&lt;BR /&gt;
    ** grab the region on the first of the group;&lt;BR /&gt;
    holdreg = region;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute showreg / character length=15;&lt;BR /&gt;
    showreg = holdreg;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
    <pubDate>Thu, 26 Mar 2009 03:49:11 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2009-03-26T03:49:11Z</dc:date>
    <item>
      <title>proc report URL help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-report-URL-help/m-p/11130#M1215</link>
      <description>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?&lt;BR /&gt;
&lt;BR /&gt;
proc report data = report_data_fam ( where = ( day &amp;gt;= TODAY() - 7 and src eq &amp;amp;src ) )&lt;BR /&gt;
                     nowd&lt;BR /&gt;
                     split = ' '&lt;BR /&gt;
                     style( header ) = { background=CX5382A1&lt;BR /&gt;
                                         foreground=white&lt;BR /&gt;
                                         font_size = 3       }&lt;BR /&gt;
                     style( column ) = { font_size = 3 };&lt;BR /&gt;
           column src logop platform site day,( units_tested units_failed yield ) dummy;&lt;BR /&gt;
           define src          / ' ' group;&lt;BR /&gt;
           define logop        / ' ' group;&lt;BR /&gt;
           define platform     / ' ' group;&lt;BR /&gt;
           define site         / ' ' group;&lt;BR /&gt;
           define day          / ' ' across format = MMDDYY. descending;&lt;BR /&gt;
           define units_tested / 'T' analysis;&lt;BR /&gt;
           define units_failed / 'F' analysis;&lt;BR /&gt;
           define yield        / 'Y' analysis format = percent9. center;&lt;BR /&gt;
           define dummy        / computed noprint;&lt;BR /&gt;
&lt;BR /&gt;
           compute site;&lt;BR /&gt;
             call define ( '_c1_',  'style', 'style=[background=CXE76F00 font_weight=bold foreground=white]' );&lt;BR /&gt;
             call define ( '_c2_',  'style', 'style=[background=CXE76F00 font_weight=bold foreground=white]' );&lt;BR /&gt;
             call define ( '_c3_',  'style', 'style=[background=CXE76F00 font_weight=bold foreground=white]' );&lt;BR /&gt;
             call define ( '_c4_',  'style', 'style=[background=CXE76F00 font_weight=bold foreground=white]' );&lt;BR /&gt;
           endcomp;&lt;BR /&gt;
&lt;BR /&gt;
           compute units_tested;&lt;BR /&gt;
             %if &amp;amp;version = Dev %then %do;&lt;BR /&gt;
               urlstring = 'http://ws-uprd-01/~am153274/SAS/Dev/GlobalQuality/YieldMetrics/'&lt;BR /&gt;
                    ||trim(site)||'_'||trim(logop)&lt;BR /&gt;
                    ||'_ProductYieldData.html#'&lt;BR /&gt;
                    ||trim(platform);&lt;BR /&gt;
             %end;&lt;BR /&gt;
             %else %do;&lt;BR /&gt;
               urlstring = 'http://ws-uprd-01/~am153274/SAS/GlobalQuality/YieldMetrics/'&lt;BR /&gt;
                    ||trim(site)||'_'||trim(logop)&lt;BR /&gt;
                    ||'_ProductYieldData.html#'&lt;BR /&gt;
                    ||trim(platform);&lt;BR /&gt;
             %end;&lt;BR /&gt;
             call define ( _col_, 'url', urlstring );&lt;BR /&gt;
           endcomp;&lt;BR /&gt;
&lt;BR /&gt;
           compute dummy;&lt;BR /&gt;
             cnt+1;&lt;BR /&gt;
             if mod( cnt, 2 ) then&lt;BR /&gt;
               call define( _row_, 'style', 'style=[background=CXFFFFFF font_weight=bold ]' );&lt;BR /&gt;
             else&lt;BR /&gt;
               call define ( _row_,  'style', 'style=[background=CXD3D3D3 font_weight=bold ]' );&lt;BR /&gt;
           endcomp;&lt;BR /&gt;
         run;</description>
      <pubDate>Wed, 25 Mar 2009 19:39:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-report-URL-help/m-p/11130#M1215</guid>
      <dc:creator>tony_mccray</dc:creator>
      <dc:date>2009-03-25T19:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: proc report URL help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-report-URL-help/m-p/11131#M1216</link>
      <description>Hi:&lt;BR /&gt;
  Consider the following output:&lt;BR /&gt;
[pre]&lt;BR /&gt;
  Region    showreg          Product           Total Sales&lt;BR /&gt;
  Asia      Asia             Boot                   62,708&lt;BR /&gt;
            Asia             Men's Casual           11,754&lt;BR /&gt;
            Asia             Men's Dress           119,366&lt;BR /&gt;
            Asia             Sandal                  8,208&lt;BR /&gt;
            Asia             Slipper               152,032&lt;BR /&gt;
            Asia             Sport Shoe              2,092&lt;BR /&gt;
            Asia             Women's Casual         25,837&lt;BR /&gt;
            Asia             Women's Dress          78,234&lt;BR /&gt;
  Asia      Asia                                   460,231&lt;BR /&gt;
                                   &lt;BR /&gt;
  Canada    Canada           Boot                  385,613&lt;BR /&gt;
            Canada           Men's Casual          441,903&lt;BR /&gt;
            Canada           Men's Dress           920,101&lt;BR /&gt;
            Canada           Sandal                 14,798&lt;BR /&gt;
            Canada           Slipper               952,751&lt;BR /&gt;
            Canada           Sport Shoe            140,389&lt;BR /&gt;
            Canada           Women's Casual        410,807&lt;BR /&gt;
            Canada           Women's Dress         989,350&lt;BR /&gt;
  Canada    Canada                               4,255,712&lt;BR /&gt;
                                 &lt;BR /&gt;
  Pacific   Pacific          Boot                  123,575&lt;BR /&gt;
            Pacific          Men's Casual          662,368&lt;BR /&gt;
            Pacific          Men's Dress           426,191&lt;BR /&gt;
            Pacific          Sandal                 48,424&lt;BR /&gt;
            Pacific          Slipper               390,740&lt;BR /&gt;
            Pacific          Sport Shoe             26,169&lt;BR /&gt;
            Pacific          Women's Casual        219,886&lt;BR /&gt;
            Pacific          Women's Dress         399,441&lt;BR /&gt;
  Pacific   Pacific                              2,296,794&lt;BR /&gt;
                              &lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                                                                                     &lt;BR /&gt;
                   &lt;BR /&gt;
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.&lt;BR /&gt;
 &lt;BR /&gt;
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.&lt;BR /&gt;
 &lt;BR /&gt;
The code that created the above output is shown below.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc sort data=sashelp.shoes out=shoes;&lt;BR /&gt;
  by region product;&lt;BR /&gt;
  where region in ('Asia','Canada', 'Pacific');&lt;BR /&gt;
run;&lt;BR /&gt;
                           &lt;BR /&gt;
proc report data=shoes nowd;&lt;BR /&gt;
  column region showreg product sales;&lt;BR /&gt;
  define region /group f=$8.;&lt;BR /&gt;
  define product / group f=$15.;&lt;BR /&gt;
  define showreg / computed f=$8.;&lt;BR /&gt;
  define sales / sum f=comma12.;&lt;BR /&gt;
  break after region / summarize skip;&lt;BR /&gt;
  compute before region ;&lt;BR /&gt;
    ** grab the region on the first of the group;&lt;BR /&gt;
    holdreg = region;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute showreg / character length=15;&lt;BR /&gt;
    showreg = holdreg;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 26 Mar 2009 03:49:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-report-URL-help/m-p/11131#M1216</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-03-26T03:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: proc report URL help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-report-URL-help/m-p/11132#M1217</link>
      <description>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:&lt;BR /&gt;
&lt;BR /&gt;
proc report data = report_data_fam ( where = ( day &amp;gt;= TODAY() - 7 and src eq &amp;amp;src ) )&lt;BR /&gt;
                      nowd&lt;BR /&gt;
                      split = ' '&lt;BR /&gt;
                      style( header ) = { background=CX5382A1&lt;BR /&gt;
                                          foreground=white&lt;BR /&gt;
                                          font_size = 3       }&lt;BR /&gt;
                      style( column ) = { font_size = 3 };&lt;BR /&gt;
            column src logop show_logop platform site day,( units_tested units_failed yield ) dummy;&lt;BR /&gt;
            define src          / ' ' group;&lt;BR /&gt;
            define logop        / ' ' group;&lt;BR /&gt;
            define show_logop   / ' ' computed noprint;&lt;BR /&gt;
            define platform     / ' ' group;&lt;BR /&gt;
            define site         / ' ' group;&lt;BR /&gt;
            define day          / ' ' across format = MMDDYY. descending;&lt;BR /&gt;
            define units_tested / 'T' analysis;&lt;BR /&gt;
            define units_failed / 'F' analysis;&lt;BR /&gt;
            define yield        / 'Y' analysis format = percent9. center;&lt;BR /&gt;
            define dummy        / computed noprint;&lt;BR /&gt;
&lt;BR /&gt;
            compute site;&lt;BR /&gt;
              call define ( '_c1_',  'style', 'style=[background=CXE76F00 font_weight=bold foreground=white]' );&lt;BR /&gt;
              call define ( '_c2_',  'style', 'style=[background=CXE76F00 font_weight=bold foreground=white]' );&lt;BR /&gt;
              call define ( '_c3_',  'style', 'style=[background=CXE76F00 font_weight=bold foreground=white]' );&lt;BR /&gt;
              call define ( '_c4_',  'style', 'style=[background=CXE76F00 font_weight=bold foreground=white]' );&lt;BR /&gt;
            endcomp;&lt;BR /&gt;
&lt;BR /&gt;
            /* Store logop for constructing links. */&lt;BR /&gt;
            compute before logop;&lt;BR /&gt;
              this_logop = logop;&lt;BR /&gt;
            endcomp;&lt;BR /&gt;
&lt;BR /&gt;
            compute show_logop / character length=3;&lt;BR /&gt;
              show_logop = this_logop;&lt;BR /&gt;
            endcomp;&lt;BR /&gt;
&lt;BR /&gt;
            compute units_tested;&lt;BR /&gt;
              %if &amp;amp;version = dev %then %do;&lt;BR /&gt;
                urlstring = 'http://ws-uprd-01.west/~am153274/SAS/Dev/GlobalQuality/YieldMetrics/'&lt;BR /&gt;
                     ||trim(site)||'_'||trim(this_logop)&lt;BR /&gt;
                     ||'_ProductYieldData.html#'&lt;BR /&gt;
                     ||trim(platform);&lt;BR /&gt;
              %end;&lt;BR /&gt;
              %else %do;&lt;BR /&gt;
                urlstring = 'http://ws-uprd-01.west/~am153274/SAS/GlobalQuality/YieldMetrics/'&lt;BR /&gt;
                     ||trim(site)||'_'||trim(this_logop)&lt;BR /&gt;
                     ||'_ProductYieldData.html#'&lt;BR /&gt;
                     ||trim(platform);&lt;BR /&gt;
              %end;&lt;BR /&gt;
              call define ( _col_, 'url', urlstring );&lt;BR /&gt;
            endcomp;&lt;BR /&gt;
&lt;BR /&gt;
            %if &amp;amp;cnt eq 2 %then %do;&lt;BR /&gt;
              compute units_failed;&lt;BR /&gt;
                %if &amp;amp;version = dev %then %do;&lt;BR /&gt;
                  urlstring = 'http://ws-uprd-01/~am153274/SAS/Dev/GlobalQuality/YieldMetrics/'&lt;BR /&gt;
                       ||trim(site)||'_'||trim(this_logop)&lt;BR /&gt;
                       ||'_HW_Fails.html#'&lt;BR /&gt;
                       ||trim(platform);&lt;BR /&gt;
                %end;&lt;BR /&gt;
                %else %do;&lt;BR /&gt;
                  urlstring = 'http://ws-uprd-01/~am153274/SAS/GlobalQuality/YieldMetrics/'&lt;BR /&gt;
                       ||trim(site)||'_'||trim(this_logop)&lt;BR /&gt;
                       ||'_HW_Fails.html#'&lt;BR /&gt;
                       ||trim(platform);&lt;BR /&gt;
                %end;&lt;BR /&gt;
                call define ( _col_, 'url', urlstring );&lt;BR /&gt;
              endcomp;&lt;BR /&gt;
           %end;&lt;BR /&gt;
&lt;BR /&gt;
            compute dummy;&lt;BR /&gt;
              cnt+1;&lt;BR /&gt;
              if mod( cnt, 2 ) then&lt;BR /&gt;
                call define( _row_, 'style', 'style=[background=CXFFFFFF font_weight=bold ]' );&lt;BR /&gt;
              else&lt;BR /&gt;
                call define ( _row_,  'style', 'style=[background=CXD3D3D3 font_weight=bold ]' );&lt;BR /&gt;
            endcomp;&lt;BR /&gt;
          run;&lt;BR /&gt;
          quit;</description>
      <pubDate>Thu, 26 Mar 2009 17:44:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-report-URL-help/m-p/11132#M1217</guid>
      <dc:creator>tony_mccray</dc:creator>
      <dc:date>2009-03-26T17:44:40Z</dc:date>
    </item>
  </channel>
</rss>

