<?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: Capturing across variable value in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Capturing-across-variable-value/m-p/65313#M7609</link>
    <description>Hi:&lt;BR /&gt;
  Actually, it would help to see ALL your PROC REPORT code, not just snippets. This is an instance where knowing what your COLUMN statement and which variables are COMPUTED and which are under the ACROSS variable would help.&lt;BR /&gt;
             &lt;BR /&gt;
  However, your ACROSS item (FYEAR) is not available to you in the way you want. Consider this program and output:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc report data=sashelp.prdsale nowd&lt;BR /&gt;
            out=repout;&lt;BR /&gt;
  title 'Across Report';&lt;BR /&gt;
  column division product year,(actual predict);&lt;BR /&gt;
  define division / group;&lt;BR /&gt;
  define product / group;&lt;BR /&gt;
  define year / across;&lt;BR /&gt;
  define actual / sum;&lt;BR /&gt;
  define predict / sum;&lt;BR /&gt;
run;&lt;BR /&gt;
              &lt;BR /&gt;
options nodate nonumber nocenter;&lt;BR /&gt;
proc print data=repout;&lt;BR /&gt;
  title 'What PROC REPORT does with ACROSS columns';&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                                &lt;BR /&gt;
"Regular" PROC REPORT output:&lt;BR /&gt;
[pre]&lt;BR /&gt;
                                                   Year&lt;BR /&gt;
                                     1993                        1994&lt;BR /&gt;
                                           Predicted                   Predicted&lt;BR /&gt;
  Division    Product     Actual Sales         Sales  Actual Sales         Sales&lt;BR /&gt;
  CONSUMER    BED           $36,637.00    $32,353.00    $37,063.00    $37,838.00&lt;BR /&gt;
              CHAIR         $34,311.00    $33,771.00    $35,703.00    $32,627.00&lt;BR /&gt;
              DESK          $37,346.00    $35,222.00    $36,926.00    $40,592.00&lt;BR /&gt;
              SOFA          $39,505.00    $38,809.00    $35,574.00    $34,811.00&lt;BR /&gt;
              TABLE         $35,958.00    $37,638.00    $33,462.00    $33,924.00&lt;BR /&gt;
  EDUCATION   BED           $32,826.00    $38,570.00    $35,511.00    $29,106.00&lt;BR /&gt;
              CHAIR         $38,709.00    $35,727.00    $39,557.00    $33,985.00&lt;BR /&gt;
              DESK          $38,821.00    $33,605.00    $36,139.00    $36,776.00&lt;BR /&gt;
              SOFA          $39,927.00    $37,669.00    $33,582.00    $29,162.00&lt;BR /&gt;
              TABLE         $35,437.00    $36,847.00    $37,343.00    $37,263.00&lt;BR /&gt;
                  &lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
                         &lt;BR /&gt;
PROC PRINT of output dataset&lt;BR /&gt;
[pre]&lt;BR /&gt;
What PROC REPORT does with ACROSS columns&lt;BR /&gt;
              &lt;BR /&gt;
Obs  DIVISION    PRODUCT             _C3_          _C4_          _C5_          _C6_  _BREAK_&lt;BR /&gt;
                       &lt;BR /&gt;
  1  CONSUMER    BED           $36,637.00    $32,353.00    $37,063.00    $37,838.00&lt;BR /&gt;
  2  CONSUMER    CHAIR         $34,311.00    $33,771.00    $35,703.00    $32,627.00&lt;BR /&gt;
  3  CONSUMER    DESK          $37,346.00    $35,222.00    $36,926.00    $40,592.00&lt;BR /&gt;
  4  CONSUMER    SOFA          $39,505.00    $38,809.00    $35,574.00    $34,811.00&lt;BR /&gt;
  5  CONSUMER    TABLE         $35,958.00    $37,638.00    $33,462.00    $33,924.00&lt;BR /&gt;
  6  EDUCATION   BED           $32,826.00    $38,570.00    $35,511.00    $29,106.00&lt;BR /&gt;
  7  EDUCATION   CHAIR         $38,709.00    $35,727.00    $39,557.00    $33,985.00&lt;BR /&gt;
  8  EDUCATION   DESK          $38,821.00    $33,605.00    $36,139.00    $36,776.00&lt;BR /&gt;
  9  EDUCATION   SOFA          $39,927.00    $37,669.00    $33,582.00    $29,162.00&lt;BR /&gt;
 10  EDUCATION   TABLE         $35,437.00    $36,847.00    $37,343.00    $37,263.00&lt;BR /&gt;
                    &lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                            &lt;BR /&gt;
You can see how PROC REPORT deals with ACROSS variable items. It gives each ACROSS item an ABSOLUTE column name. So for example _c3_ is the ACTUAL value for 1993 and _c4_ is the PREDICT value for 1993. Similarly, _c5_ is the ACTUAL value for 1994 and _c6_ is the PREDICT value for 1994.&lt;BR /&gt;
               &lt;BR /&gt;
So, if you want to USE 1993 or 1994 in your code, then you do not have visibility of the value for YEAR anymore. You only know what the absolute column numbers are for each year. So you could do something like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
compute rowr_cnr;&lt;BR /&gt;
href1993=cats("www.testurl.com?camp=", holdcamp, "?fy=", '1993', "?comp=", commcode);&lt;BR /&gt;
href1994=cats("www.testurl.com?camp=", holdcamp, "?fy=", '1994', "?comp=", commcode);&lt;BR /&gt;
call define('_c3_, "URLBP", href1993);&lt;BR /&gt;
call define('_c5_, "URLBP", href1994);&lt;BR /&gt;
endcomp;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
              &lt;BR /&gt;
Without seeing your full code, it's impossible to do more than hint at what you can do. I've seen some folks deal with needing a value for dynamic creation by "massaging" the data ahead of time or "flattening" the data and then building the URL dynamically.&lt;BR /&gt;
   &lt;BR /&gt;
cynthia</description>
    <pubDate>Fri, 05 Mar 2010 19:56:15 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2010-03-05T19:56:15Z</dc:date>
    <item>
      <title>Capturing across variable value</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Capturing-across-variable-value/m-p/65312#M7608</link>
      <description>I am adding hyperlinks to each cell in an excel spreadsheet using proc report.&lt;BR /&gt;
Each link has parameters with row values of each group value. This works fine so far.  I have Fiscal Year as an across variable.  I would like to add this to the link so that the appropriate population may be found.&lt;BR /&gt;
&lt;BR /&gt;
           DEFINE  CAMP / GROUP FORMAT= $6. WIDTH=6     SPACING=2  RIGHT "Campaign"  order=internal;&lt;BR /&gt;
&lt;BR /&gt;
        DEFINE  COMM / GROUP FORMAT= $14. WIDTH=14  SPACING=2 FLOW  LEFT "CommCode" order=internal ;&lt;BR /&gt;
        DEFINE  FYEAR / ACROSS FORMAT= $6. WIDTH=9     SPACING=2   RIGHT "Fiscal Year" descending;&lt;BR /&gt;
&lt;BR /&gt;
      compute before campidc /&lt;BR /&gt;
           style={background=#C5BE97};&lt;BR /&gt;
           line  campidc $zcampnm.;&lt;BR /&gt;
           holdcamp = campidc;&lt;BR /&gt;
       endcomp;&lt;BR /&gt;
  &lt;BR /&gt;
       compute after campidc ;&lt;BR /&gt;
           line  " ";&lt;BR /&gt;
       endcomp;&lt;BR /&gt;
       compute commcode;&lt;BR /&gt;
             if  commcode = 'z' then&lt;BR /&gt;
                   call define(_ROW_,'STYLE','style={background=#B6DDE8}');&lt;BR /&gt;
        endcomp;&lt;BR /&gt;
      compute rowr_cnr;&lt;BR /&gt;
              href=cats("www.testurl.com?camp=", holdcamp, "?fy=", fyear, "?comp=", commcode);&lt;BR /&gt;
              call define(_col_, "URLBP", href);&lt;BR /&gt;
      endcomp;&lt;BR /&gt;
&lt;BR /&gt;
Now here I cannot capture the value of FYEAR, in fact it puts 0 when it should be a string like FY2010.&lt;BR /&gt;
&lt;BR /&gt;
Is there anyway I can capture a non-break value?</description>
      <pubDate>Fri, 05 Mar 2010 18:38:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Capturing-across-variable-value/m-p/65312#M7608</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2010-03-05T18:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Capturing across variable value</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Capturing-across-variable-value/m-p/65313#M7609</link>
      <description>Hi:&lt;BR /&gt;
  Actually, it would help to see ALL your PROC REPORT code, not just snippets. This is an instance where knowing what your COLUMN statement and which variables are COMPUTED and which are under the ACROSS variable would help.&lt;BR /&gt;
             &lt;BR /&gt;
  However, your ACROSS item (FYEAR) is not available to you in the way you want. Consider this program and output:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc report data=sashelp.prdsale nowd&lt;BR /&gt;
            out=repout;&lt;BR /&gt;
  title 'Across Report';&lt;BR /&gt;
  column division product year,(actual predict);&lt;BR /&gt;
  define division / group;&lt;BR /&gt;
  define product / group;&lt;BR /&gt;
  define year / across;&lt;BR /&gt;
  define actual / sum;&lt;BR /&gt;
  define predict / sum;&lt;BR /&gt;
run;&lt;BR /&gt;
              &lt;BR /&gt;
options nodate nonumber nocenter;&lt;BR /&gt;
proc print data=repout;&lt;BR /&gt;
  title 'What PROC REPORT does with ACROSS columns';&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                                &lt;BR /&gt;
"Regular" PROC REPORT output:&lt;BR /&gt;
[pre]&lt;BR /&gt;
                                                   Year&lt;BR /&gt;
                                     1993                        1994&lt;BR /&gt;
                                           Predicted                   Predicted&lt;BR /&gt;
  Division    Product     Actual Sales         Sales  Actual Sales         Sales&lt;BR /&gt;
  CONSUMER    BED           $36,637.00    $32,353.00    $37,063.00    $37,838.00&lt;BR /&gt;
              CHAIR         $34,311.00    $33,771.00    $35,703.00    $32,627.00&lt;BR /&gt;
              DESK          $37,346.00    $35,222.00    $36,926.00    $40,592.00&lt;BR /&gt;
              SOFA          $39,505.00    $38,809.00    $35,574.00    $34,811.00&lt;BR /&gt;
              TABLE         $35,958.00    $37,638.00    $33,462.00    $33,924.00&lt;BR /&gt;
  EDUCATION   BED           $32,826.00    $38,570.00    $35,511.00    $29,106.00&lt;BR /&gt;
              CHAIR         $38,709.00    $35,727.00    $39,557.00    $33,985.00&lt;BR /&gt;
              DESK          $38,821.00    $33,605.00    $36,139.00    $36,776.00&lt;BR /&gt;
              SOFA          $39,927.00    $37,669.00    $33,582.00    $29,162.00&lt;BR /&gt;
              TABLE         $35,437.00    $36,847.00    $37,343.00    $37,263.00&lt;BR /&gt;
                  &lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
                         &lt;BR /&gt;
PROC PRINT of output dataset&lt;BR /&gt;
[pre]&lt;BR /&gt;
What PROC REPORT does with ACROSS columns&lt;BR /&gt;
              &lt;BR /&gt;
Obs  DIVISION    PRODUCT             _C3_          _C4_          _C5_          _C6_  _BREAK_&lt;BR /&gt;
                       &lt;BR /&gt;
  1  CONSUMER    BED           $36,637.00    $32,353.00    $37,063.00    $37,838.00&lt;BR /&gt;
  2  CONSUMER    CHAIR         $34,311.00    $33,771.00    $35,703.00    $32,627.00&lt;BR /&gt;
  3  CONSUMER    DESK          $37,346.00    $35,222.00    $36,926.00    $40,592.00&lt;BR /&gt;
  4  CONSUMER    SOFA          $39,505.00    $38,809.00    $35,574.00    $34,811.00&lt;BR /&gt;
  5  CONSUMER    TABLE         $35,958.00    $37,638.00    $33,462.00    $33,924.00&lt;BR /&gt;
  6  EDUCATION   BED           $32,826.00    $38,570.00    $35,511.00    $29,106.00&lt;BR /&gt;
  7  EDUCATION   CHAIR         $38,709.00    $35,727.00    $39,557.00    $33,985.00&lt;BR /&gt;
  8  EDUCATION   DESK          $38,821.00    $33,605.00    $36,139.00    $36,776.00&lt;BR /&gt;
  9  EDUCATION   SOFA          $39,927.00    $37,669.00    $33,582.00    $29,162.00&lt;BR /&gt;
 10  EDUCATION   TABLE         $35,437.00    $36,847.00    $37,343.00    $37,263.00&lt;BR /&gt;
                    &lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                            &lt;BR /&gt;
You can see how PROC REPORT deals with ACROSS variable items. It gives each ACROSS item an ABSOLUTE column name. So for example _c3_ is the ACTUAL value for 1993 and _c4_ is the PREDICT value for 1993. Similarly, _c5_ is the ACTUAL value for 1994 and _c6_ is the PREDICT value for 1994.&lt;BR /&gt;
               &lt;BR /&gt;
So, if you want to USE 1993 or 1994 in your code, then you do not have visibility of the value for YEAR anymore. You only know what the absolute column numbers are for each year. So you could do something like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
compute rowr_cnr;&lt;BR /&gt;
href1993=cats("www.testurl.com?camp=", holdcamp, "?fy=", '1993', "?comp=", commcode);&lt;BR /&gt;
href1994=cats("www.testurl.com?camp=", holdcamp, "?fy=", '1994', "?comp=", commcode);&lt;BR /&gt;
call define('_c3_, "URLBP", href1993);&lt;BR /&gt;
call define('_c5_, "URLBP", href1994);&lt;BR /&gt;
endcomp;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
              &lt;BR /&gt;
Without seeing your full code, it's impossible to do more than hint at what you can do. I've seen some folks deal with needing a value for dynamic creation by "massaging" the data ahead of time or "flattening" the data and then building the URL dynamically.&lt;BR /&gt;
   &lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 05 Mar 2010 19:56:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Capturing-across-variable-value/m-p/65313#M7609</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-03-05T19:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Capturing across variable value</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Capturing-across-variable-value/m-p/65314#M7610</link>
      <description>I think you answered my question.  I will have to create the link for each group of the across variable.  I was hoping there was some way within REPORT to grab this.  I included the code below in case you see any further ways to handle this.&lt;BR /&gt;
&lt;BR /&gt;
Thanks.&lt;BR /&gt;
&lt;BR /&gt;
        PROC REPORT DATA=WORK.dashrept LS=126 PS=35  SPLIT="/" NOCENTER nofs ;&lt;BR /&gt;
&lt;BR /&gt;
        COLUMN  ( campidc campidc = camp commcode commcode = comm fyear,(&lt;BR /&gt;
                 ( "Contract"(rowr_cnr rowr_cnn rowr_cnt rowr_pct rowr_pts rowr_val))&lt;BR /&gt;
                 ( "Response"(rown_cnr rown_cnn rown_cnt rown_pct))));&lt;BR /&gt;
        DEFINE  CAMPIDC / GROUP FORMAT= $12. WIDTH=9     SPACING=2  RIGHT "Campaign" order=internal descending noprint  ;&lt;BR /&gt;
        DEFINE  CAMP / GROUP FORMAT= $6. WIDTH=6     SPACING=2  RIGHT "Campaign"  order=internal;&lt;BR /&gt;
        DEFINE  COMMCODE / GROUP FORMAT= $zcommnm. WIDTH=20  SPACING=2 FLOW  LEFT "Communication" order=internal ;&lt;BR /&gt;
        DEFINE  COMM / GROUP FORMAT= $14. WIDTH=14  SPACING=2 FLOW  LEFT "CommCode" order=internal ;&lt;BR /&gt;
        DEFINE  FYEAR / ACROSS FORMAT= $6. WIDTH=9     SPACING=2   RIGHT "Fiscal Year" descending;&lt;BR /&gt;
        DEFINE  rowr_cnr / SUM FORMAT= comma12. WIDTH=8     SPACING=2   RIGHT "RESP"&lt;BR /&gt;
        style(column)={borderleftcolor=#C5BE97 borderleftwidth=6 borderbottomcolor=#CCCCCC borderbottomwidth=1&lt;BR /&gt;
               bordertopcolor=#CCCCCC bordertopwidth=1  };&lt;BR /&gt;
        DEFINE  rowr_cnn / SUM FORMAT= comma12. WIDTH=8     SPACING=2   RIGHT "NON-RESP" ;&lt;BR /&gt;
        DEFINE  rowr_cnt / SUM FORMAT= comma12. WIDTH=8     SPACING=2   RIGHT "TOTAL" ;&lt;BR /&gt;
        DEFINE  rowr_pct / SUM FORMAT= percent8.5 WIDTH=8     SPACING=2   RIGHT "RESP %" ;&lt;BR /&gt;
        DEFINE  rowr_pts / SUM FORMAT= comma12. WIDTH=8     SPACING=2   RIGHT "POINTS" ;&lt;BR /&gt;
        DEFINE  rowr_val / SUM FORMAT= dollar16.2 WIDTH=15     SPACING=2   RIGHT "REVENUE" ;&lt;BR /&gt;
        DEFINE  rown_cnr / SUM FORMAT= comma12. WIDTH=8     SPACING=2   RIGHT "RESP"&lt;BR /&gt;
        style(column)={borderleftcolor=#B6DDE8 borderleftwidth=6 borderbottomcolor=#CCCCCC borderbottomwidth=1&lt;BR /&gt;
               bordertopcolor=#CCCCCC bordertopwidth=1  };&lt;BR /&gt;
        DEFINE  rown_cnn / SUM FORMAT= comma12. WIDTH=8     SPACING=2   RIGHT "NON-RESP" ;&lt;BR /&gt;
        DEFINE  rown_cnt / SUM FORMAT= comma12. WIDTH=8     SPACING=2   RIGHT "TOTAL" ;&lt;BR /&gt;
        DEFINE  rown_pct / SUM FORMAT= percent8.5 WIDTH=8     SPACING=2   RIGHT "RESP %" ;&lt;BR /&gt;
&lt;BR /&gt;
       compute before campidc /&lt;BR /&gt;
           style={background=#C5BE97};&lt;BR /&gt;
           line  campidc $zcampnm.;&lt;BR /&gt;
           holdcamp = campidc;&lt;BR /&gt;
       endcomp;&lt;BR /&gt;
 &lt;BR /&gt;
       compute after campidc ;&lt;BR /&gt;
           line  " ";&lt;BR /&gt;
       endcomp;&lt;BR /&gt;
       compute commcode;&lt;BR /&gt;
             if  commcode = 'z' then&lt;BR /&gt;
                   call define(_ROW_,'STYLE','style={background=#B6DDE8}');&lt;BR /&gt;
        endcomp;&lt;BR /&gt;
      compute rowr_cnr;&lt;BR /&gt;
              href=cats("www.testurl.com?camp=", holdcamp, "?fy=", fyear, "?comp=", commcode);&lt;BR /&gt;
              call define(_col_, "URLBP", href);&lt;BR /&gt;
      endcomp;&lt;BR /&gt;
&lt;BR /&gt;
     RUN;</description>
      <pubDate>Fri, 05 Mar 2010 20:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Capturing-across-variable-value/m-p/65314#M7610</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2010-03-05T20:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Capturing across variable value</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Capturing-across-variable-value/m-p/65315#M7611</link>
      <description>Hi:&lt;BR /&gt;
  I see that you have a LOT of nested variables under year. So you're right, you would have to hardcode the year value. If this was my report to do,  I would be very tempted to flatten or pre-summarize the dataset and then build the URL so that absolute column numbers were not involved. Also remember, that even NOPRINT variables will get a column number, so you have to include them in your coding.&lt;BR /&gt;
&lt;BR /&gt;
  Also, do keep in mind when you use ODS, that some options, such as LS, PS, WIDTH, SPACING, FLOW are LISTING only options that are are simply ignored by ODS HTML, RTF and PDF. You don't indicate what your destiantion of choice is (no ODS statements) but given that you're coding a URL, I suspect it is ODS HTML. &lt;BR /&gt;
 &lt;BR /&gt;
  Good luck!&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 05 Mar 2010 21:00:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Capturing-across-variable-value/m-p/65315#M7611</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-03-05T21:00:32Z</dc:date>
    </item>
  </channel>
</rss>

