<?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: IF statement to define the value of a macro variable for a report title in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-statement-to-define-the-value-of-a-macro-variable-for-a/m-p/569567#M34072</link>
    <description>&lt;P&gt;TITLE needs a quoted string&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title1 "&amp;amp;startdate to &amp;amp;enddate";
title2 "&amp;amp;comp_name";&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 27 Jun 2019 18:04:31 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-06-27T18:04:31Z</dc:date>
    <item>
      <title>IF statement to define the value of a macro variable for a report title</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-statement-to-define-the-value-of-a-macro-variable-for-a/m-p/569565#M34071</link>
      <description>&lt;P&gt;Hi All,&lt;BR /&gt;&lt;BR /&gt;I'm sure this is simple to most of you, but is stumping me at the moment. I have a program that builds a detail table. It has start, end date, and company # parms (since this can run for either Brand ID# within our organization.&lt;BR /&gt;I then summarize the data and do a proc report. However, I want to change title2 line in the output based off of the Brand ID #.&lt;BR /&gt;&lt;BR /&gt;I am trying this, but my results are not what I expect:&lt;BR /&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;if &amp;amp;brand_code = 10 then call symputx('comp_name','ABC Company');&lt;BR /&gt;else call symputx( 'comp_name', 'XYZ Company');&lt;BR /&gt;%put &amp;amp;compname = comp_name;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;then in the proc report:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;title1 &amp;amp;startdate ' to ' &amp;amp;enddate;&lt;BR /&gt;title2 &amp;amp;compname;&lt;/P&gt;&lt;P&gt;proc report data=work.vendor;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;My headings at report output time are :&lt;BR /&gt;&lt;BR /&gt;06/01/2019 to 06/10/19&lt;BR /&gt;&amp;amp;compname&lt;BR /&gt;&lt;BR /&gt;----------------------------------------------------------------------&lt;BR /&gt;my log shows this:&lt;BR /&gt;SYMBOLGEN: Macro variable BRAND_CODE resolves to 10&lt;BR /&gt;137 if &amp;amp;brand_code = 10 then call symputx('comp_name','ABC Company');&lt;BR /&gt;138 else call symputx( 'comp_name', 'XYZ Company');&lt;BR /&gt;139&lt;BR /&gt;140 %put &amp;amp;compname = comp_name;&lt;BR /&gt;WARNING: Apparent symbolic reference COMPNAME not resolved.&lt;BR /&gt;&amp;amp;compname = comp_name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated!.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 17:57:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-statement-to-define-the-value-of-a-macro-variable-for-a/m-p/569565#M34071</guid>
      <dc:creator>cnilsen</dc:creator>
      <dc:date>2019-06-27T17:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement to define the value of a macro variable for a report title</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-statement-to-define-the-value-of-a-macro-variable-for-a/m-p/569567#M34072</link>
      <description>&lt;P&gt;TITLE needs a quoted string&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title1 "&amp;amp;startdate to &amp;amp;enddate";
title2 "&amp;amp;comp_name";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Jun 2019 18:04:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-statement-to-define-the-value-of-a-macro-variable-for-a/m-p/569567#M34072</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-27T18:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement to define the value of a macro variable for a report title</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-statement-to-define-the-value-of-a-macro-variable-for-a/m-p/569591#M34073</link>
      <description>&lt;P&gt;You are trying to display the value of the macro variable BEFORE the data step has had a chance to run and create it. Move your %PUT statement to AFTER the data step.&amp;nbsp; Also make sure to use the same name in the %PUT as the name you used in the CALL SYMPUTX() call(s).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
if &amp;amp;brand_code = 10 then call symputx('comp_name','ABC Company');
else call symputx( 'comp_name', 'XYZ Company');
run;

%put BRAND_CODE = &amp;amp;brand_code ;
%put COMP_NAME = &amp;amp;comp_name ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 18:51:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-statement-to-define-the-value-of-a-macro-variable-for-a/m-p/569591#M34073</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-27T18:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement to define the value of a macro variable for a report title</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-statement-to-define-the-value-of-a-macro-variable-for-a/m-p/569593#M34074</link>
      <description>&lt;P&gt;Title1 display correctly with the start &amp;amp; end dates.. as is.&lt;/P&gt;&lt;P&gt;adding quotes to title2 as suggested didn't make a difference and the variable still is unresolved as the log shows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;140 %put &amp;amp;compname = comp_name;&lt;BR /&gt;WARNING: Apparent symbolic reference COMPNAME not resolved.&lt;BR /&gt;&amp;amp;compname = comp_name&lt;BR /&gt;141 run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;should I be using a different method to set the value of compname for use in the report title?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 18:52:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-statement-to-define-the-value-of-a-macro-variable-for-a/m-p/569593#M34074</guid>
      <dc:creator>cnilsen</dc:creator>
      <dc:date>2019-06-27T18:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement to define the value of a macro variable for a report title</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-statement-to-define-the-value-of-a-macro-variable-for-a/m-p/569595#M34075</link>
      <description>&lt;P&gt;that worked...&amp;nbsp; (I was close.).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Much appreciated to those who offered guidance.!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 18:59:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-statement-to-define-the-value-of-a-macro-variable-for-a/m-p/569595#M34075</guid>
      <dc:creator>cnilsen</dc:creator>
      <dc:date>2019-06-27T18:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement to define the value of a macro variable for a report title</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-statement-to-define-the-value-of-a-macro-variable-for-a/m-p/569619#M34078</link>
      <description>&lt;P&gt;Pay close attention to my code. The variable name is comp_name (note the underline!).&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 20:21:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/IF-statement-to-define-the-value-of-a-macro-variable-for-a/m-p/569619#M34078</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-27T20:21:00Z</dc:date>
    </item>
  </channel>
</rss>

