<?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: ODS HTML - Proc Report in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-HTML-Proc-Report/m-p/167781#M12229</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Some comments:&lt;/P&gt;&lt;P&gt;1) you probably don't need %let for 2 reasons;&lt;/P&gt;&lt;P&gt;--%LET works at compile time not execution, so your macro var is being set to the string 'file' and NOT, as you hope, to the current row's value for r the FILE variable.&lt;/P&gt;&lt;P&gt;--PROC REPORT will do what you want and use the value of the FILE var dynamically&lt;/P&gt;&lt;P&gt;2) BUT, in order for PROC REPORT to work, you have to specify the variables in the correct order on the COLUMN statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, let's take this hypothetical example. SASHELP.CLASS has 5 variables: NAME, SEX, AGE, HEIGHT and WEIGHT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I have this COLUMN statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COLUMN NAME AGE HEIGHT WEIGHT SEX;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and this silly COMPUTE block:&lt;/P&gt;&lt;P&gt;COMPUTE height;&lt;/P&gt;&lt;P&gt; if SEX = 'F' then height=height*1.1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; else if SEX='M" then height = height * 1.25;&lt;/P&gt;&lt;P&gt;ENDCOMP;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My&amp;nbsp; COMPUTE block will fail. PROC REPORT builds the report row one column at a time, building the row from left to right. SO, when PROC REPORT is running the compute block for height, it has NO (ZERO, ZILCH) visibility of the value for SEX because SEX has not yet been placed on the report row. This is a fundamental principle of PROC REPORT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are good examples in the documentation of how this works and examples of how to build something like a URL dynamically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 05 Apr 2014 02:04:32 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2014-04-05T02:04:32Z</dc:date>
    <item>
      <title>ODS HTML - Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-HTML-Proc-Report/m-p/167780#M12228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAS 9.2 32bit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to pass a column name dynamically within proc report? &lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN style="line-height: 1.5em; font-size: 10pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;I am working on adding google analytics to track reporting usage. Based on the way our ODS .html pages that surface our reports are built, this is how it needs to be created or very &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;similarly&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5em; font-size: 10pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I need to pass the 'file' column within call define dynamically (into variable &amp;amp;string) so we know which report was viewed . I am having trouble getting the column name to act as a variable and resolve correctly. Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Running on 9.2 32bit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;options nocenter ;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;DATA testing;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; INPUT filename $ filetype $ file $;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; DATALINES;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; abc_rpt html hello&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; xyz_rpt pdf test&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;ods listing close;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;ods html file="C:\Testing_links.html"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;style=sasweb&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;title;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;footnote;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;options nodate nonumber;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;proc report data=Testing nowd missing split='/'&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;style(report)={just=center}&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;column filename filetype &lt;STRONG&gt;file&lt;/STRONG&gt; ;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;define filename&amp;nbsp; / order "Report Name" style=[just=left width=4in];&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;define filetype&amp;nbsp; / display order=data "Format" style=[just=left width=.5in];&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;define file /noprint;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;compute filetype;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;if strip(filename) ne '' then do;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;urlstring=strip(filename);&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;%let string = file;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;CALL DEFINE(_COL_, 'URL', strip(urlstring) || ' "target="_blank' || %unquote(%nrbquote('" onClick="javascript: pageTracker._trackPageview(''/home/&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&amp;amp;string&lt;/STRONG&gt;'' );')));&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;end;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;endcomp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;ods html close;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;ods listing;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;The issue is &amp;amp;string is not being resolved correctly.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Once the code above is ran, view the source of the html page&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;Towards the bottom of the html's source page you will see the lines below. The setup of quotes/double quotes is&lt;EM&gt; very important&lt;/EM&gt; and it should look like both examples below. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;lt;a href="abc_rpt "target="_blank" onClick="javascript: pageTracker._trackPageview('/home/&lt;STRONG&gt;file&lt;/STRONG&gt;' );"&amp;gt;html&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;lt;a href="xyz_rpt "target="_blank" onClick="javascript: pageTracker._trackPageview('/home/&lt;STRONG&gt;file&lt;/STRONG&gt;' );"&amp;gt;pdf&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;The correct output would look like:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;lt;a href="abc_rpt "target="_blank" onClick="javascript: pageTracker._trackPageview('/home/&lt;STRONG&gt;hello&lt;/STRONG&gt;' );"&amp;gt;html&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;lt;a href="xyz_rpt "target="_blank" onClick="javascript: pageTracker._trackPageview('/home/&lt;STRONG&gt;test&lt;/STRONG&gt;' );"&amp;gt;pdf&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Any help is appreciated! Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2014 20:06:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-HTML-Proc-Report/m-p/167780#M12228</guid>
      <dc:creator>wreneau</dc:creator>
      <dc:date>2014-04-03T20:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: ODS HTML - Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-HTML-Proc-Report/m-p/167781#M12229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Some comments:&lt;/P&gt;&lt;P&gt;1) you probably don't need %let for 2 reasons;&lt;/P&gt;&lt;P&gt;--%LET works at compile time not execution, so your macro var is being set to the string 'file' and NOT, as you hope, to the current row's value for r the FILE variable.&lt;/P&gt;&lt;P&gt;--PROC REPORT will do what you want and use the value of the FILE var dynamically&lt;/P&gt;&lt;P&gt;2) BUT, in order for PROC REPORT to work, you have to specify the variables in the correct order on the COLUMN statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, let's take this hypothetical example. SASHELP.CLASS has 5 variables: NAME, SEX, AGE, HEIGHT and WEIGHT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I have this COLUMN statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COLUMN NAME AGE HEIGHT WEIGHT SEX;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and this silly COMPUTE block:&lt;/P&gt;&lt;P&gt;COMPUTE height;&lt;/P&gt;&lt;P&gt; if SEX = 'F' then height=height*1.1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; else if SEX='M" then height = height * 1.25;&lt;/P&gt;&lt;P&gt;ENDCOMP;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My&amp;nbsp; COMPUTE block will fail. PROC REPORT builds the report row one column at a time, building the row from left to right. SO, when PROC REPORT is running the compute block for height, it has NO (ZERO, ZILCH) visibility of the value for SEX because SEX has not yet been placed on the report row. This is a fundamental principle of PROC REPORT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are good examples in the documentation of how this works and examples of how to build something like a URL dynamically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Apr 2014 02:04:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-HTML-Proc-Report/m-p/167781#M12229</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2014-04-05T02:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: ODS HTML - Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-HTML-Proc-Report/m-p/167782#M12230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Cynthia. It was literally as easy as changing the order in the Column statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 21:37:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-HTML-Proc-Report/m-p/167782#M12230</guid>
      <dc:creator>wreneau</dc:creator>
      <dc:date>2014-04-07T21:37:06Z</dc:date>
    </item>
  </channel>
</rss>

