<?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 It is possible to use a format as value for a url= style option? in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/It-is-possible-to-use-a-format-as-value-for-a-url-style-option/m-p/743249#M25014</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It is possible to use a format as value for a url= style option?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example 1 - Same URL for all the values&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods pdf file='eg1.pdf';

proc report data=class spanrows; 
    column sex--weight;
    define sex / order style(column)=[url = 'https://sas.com'];
    define height--weight  / display;
run;

ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example 2 - Using a format (doesn't work)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
    value $ url 'M'='https://sas.com'
                'F'='https://communities.sas.com/';
run;

ods pdf file='eg2.pdf';

proc report data=class spanrows; 
    column sex--weight;
    define sex / order style(column)=[url = $url.];
    define height--weight  / display;

run;

ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Example 3 - Using call define (workaround)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods pdf file='eg3.pdf';

proc report data=class spanrows; 
    column sex--weight;
    define sex / order;
    define height--weight  / display;
    
    compute sex;
        if sex='M' then call define (_COL_,'url','https://sas.com');
        else call define (_COL_,'url','https://communities.sas.com/');
    endcomp;
run;

ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
    <pubDate>Sun, 23 May 2021 18:14:16 GMT</pubDate>
    <dc:creator>xxformat_com</dc:creator>
    <dc:date>2021-05-23T18:14:16Z</dc:date>
    <item>
      <title>It is possible to use a format as value for a url= style option?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/It-is-possible-to-use-a-format-as-value-for-a-url-style-option/m-p/743249#M25014</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It is possible to use a format as value for a url= style option?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example 1 - Same URL for all the values&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods pdf file='eg1.pdf';

proc report data=class spanrows; 
    column sex--weight;
    define sex / order style(column)=[url = 'https://sas.com'];
    define height--weight  / display;
run;

ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example 2 - Using a format (doesn't work)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
    value $ url 'M'='https://sas.com'
                'F'='https://communities.sas.com/';
run;

ods pdf file='eg2.pdf';

proc report data=class spanrows; 
    column sex--weight;
    define sex / order style(column)=[url = $url.];
    define height--weight  / display;

run;

ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Example 3 - Using call define (workaround)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods pdf file='eg3.pdf';

proc report data=class spanrows; 
    column sex--weight;
    define sex / order;
    define height--weight  / display;
    
    compute sex;
        if sex='M' then call define (_COL_,'url','https://sas.com');
        else call define (_COL_,'url','https://communities.sas.com/');
    endcomp;
run;

ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Sun, 23 May 2021 18:14:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/It-is-possible-to-use-a-format-as-value-for-a-url-style-option/m-p/743249#M25014</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2021-05-23T18:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: It is possible to use a format as value for a url= style option?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/It-is-possible-to-use-a-format-as-value-for-a-url-style-option/m-p/743253#M25015</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; The format approach should work. It worked for me using SASHELP.CLASS:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
    value $url 'M'='https://www.sas.com'
               'F'='https://www.google.com';
run;

ods pdf(id=1) file="c:\temp\url_examp.pdf";
ods html(id=2) path='c:\temp' (url=none) file='url_examp.html';
ods rtf(id=3) file="c:\temp\url_examp.rtf";

proc report data=sashelp.class spanrows; 
    title 'URL example with format';
    column sex age name height weight;
    define sex / order style(column)=[url=$url.];
run;

ods pdf(id=1) close;
ods html(id=2) close;
ods rtf(id=3) close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The CALL DEFINE example, but I prefer using it for making dynamic URLs:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods pdf(id=1) file="c:\temp\url_dyn.pdf";
ods html(id=2) path='c:\temp' (url=none) file='url_dyn.html';
ods rtf(id=3) file="c:\temp\url_dyn.rtf";

proc report data=sashelp.class(obs=5) spanrows; 
    title 'URL example with call define';
    column sex age name height weight;
    define sex / order;
	compute name;
	    urlstr = catt('https://www.google.com/search?q=books+',name);
        call define(_col_,'url',urlstr);
	endcomp;
run;

ods pdf(id=1) close;
ods html(id=2) close;
ods rtf(id=3) close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Sun, 23 May 2021 18:36:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/It-is-possible-to-use-a-format-as-value-for-a-url-style-option/m-p/743253#M25015</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2021-05-23T18:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: It is possible to use a format as value for a url= style option?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/It-is-possible-to-use-a-format-as-value-for-a-url-style-option/m-p/743254#M25016</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Can you show the LOG because for me it works fine?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I haven't used PDF as output destination though but that cannot be the reason of your problem.&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Sun, 23 May 2021 18:39:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/It-is-possible-to-use-a-format-as-value-for-a-url-style-option/m-p/743254#M25016</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-05-23T18:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: It is possible to use a format as value for a url= style option?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/It-is-possible-to-use-a-format-as-value-for-a-url-style-option/m-p/743255#M25017</link>
      <description>&lt;P&gt;There is no issue in the log. There is just no link created in the PDF file.&lt;/P&gt;</description>
      <pubDate>Sun, 23 May 2021 18:55:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/It-is-possible-to-use-a-format-as-value-for-a-url-style-option/m-p/743255#M25017</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2021-05-23T18:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: It is possible to use a format as value for a url= style option?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/It-is-possible-to-use-a-format-as-value-for-a-url-style-option/m-p/743257#M25018</link>
      <description>&lt;P&gt;It might be dependent on the way you look at the pdf file. Resolving URL strings to a link is a matter of the user agent.&lt;/P&gt;</description>
      <pubDate>Sun, 23 May 2021 19:00:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/It-is-possible-to-use-a-format-as-value-for-a-url-style-option/m-p/743257#M25018</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-23T19:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: It is possible to use a format as value for a url= style option?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/It-is-possible-to-use-a-format-as-value-for-a-url-style-option/m-p/743258#M25019</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks Cynthia, testing again with your program helped me realize that the code I sent missed a format.&lt;/P&gt;&lt;P&gt;The $URL applies to the formatted value of sex, not the unformatted value as I was expecting.&lt;/P&gt;&lt;P&gt;Here is an example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
    value $ sex 'M'='Male'
                'F'='Female';
    *value $ url 'M'='https://sas.com'
                'F'='https://communities.sas.com/'; *it does not work;
                
    value $ url 'Male'='https://sas.com'
                'Female'='https://communities.sas.com/'; *it works;

run;

ods pdf file='eg2.pdf';

proc report data=class spanrows; 
    column sex--weight;
    define sex / order format=$sex. style(column)=[url = $url.];
    define height--weight  / display;

run;

ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 May 2021 19:18:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/It-is-possible-to-use-a-format-as-value-for-a-url-style-option/m-p/743258#M25019</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2021-05-23T19:18:37Z</dc:date>
    </item>
  </channel>
</rss>

