<?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 condition in a 'call symput' in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/IF-condition-in-a-call-symput/m-p/641635#M191271</link>
    <description>&lt;P&gt;There's really no need to create macro variable &amp;amp;giorno in this situation. The WEEKDAY() function eliminates the need for &amp;amp;giorno. That would also simplify the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  if weekday(today())=2 then date=today()-3;
  else date=today()-1;
  call symputx('data_estrazione_3',put(date,date9.));
run;

%put&amp;nbsp;&amp;amp;=data_estrazione_3;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 21 Apr 2020 14:48:50 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-04-21T14:48:50Z</dc:date>
    <item>
      <title>IF condition in a 'call symput'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-condition-in-a-call-symput/m-p/641622#M191261</link>
      <description>&lt;P&gt;Good afternoon,&lt;/P&gt;
&lt;P&gt;I need to put contidions in a call symput to avoid problems due to 'saturday' and 'sunday'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I try with this but it's not quiet correct:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;_null_&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; symput(&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'giorno'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,compress(put(today()-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; , &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;DOWNAME.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ))) ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; 'giorno =' &amp;amp;giorno.;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;_null_&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;gg= &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'&amp;amp;giorno.'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; gg eq &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'Monday'&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;then&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; symput(&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'data_estrazione_3'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,compress(put(today()-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;3&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; ,&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;else&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; symput(&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'data_estrazione_3'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,compress(put(today()-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; ,&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; data_estrazione_3= &amp;amp;data_estrazione.;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Please, can you help me?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Thanks, Tecla &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 14:06:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-condition-in-a-call-symput/m-p/641622#M191261</guid>
      <dc:creator>Tecla1</dc:creator>
      <dc:date>2020-04-21T14:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: IF condition in a 'call symput'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-condition-in-a-call-symput/m-p/641625#M191263</link>
      <description>&lt;P&gt;The obvious error to me is in this line:&lt;/P&gt;
&lt;PRE&gt;%put data_estrazione_3= &amp;amp;data_estrazione.;&lt;/PRE&gt;
&lt;P&gt;You don't have a macro variable named &lt;FONT face="courier new,courier"&gt;&amp;amp;data_estrazione&lt;/FONT&gt; so you get the error message.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 14:25:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-condition-in-a-call-symput/m-p/641625#M191263</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-21T14:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: IF condition in a 'call symput'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-condition-in-a-call-symput/m-p/641629#M191267</link>
      <description>&lt;P&gt;Another issue with the code is when we call the macro variable please call in double quotes and not single quote. In the code the macro variable is called in single quote due to which it will not resolve. Try calling the macro variable with double quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;gg= '&amp;amp;giorno.';&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Apr 2020 14:23:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-condition-in-a-call-symput/m-p/641629#M191267</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2020-04-21T14:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: IF condition in a 'call symput'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-condition-in-a-call-symput/m-p/641630#M191268</link>
      <description>&lt;P&gt;Change:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;gg= '&amp;amp;giorno.';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;gg= "&amp;amp;giorno.";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in order for the the macro variable to resolve and be usable in your if-else logic later.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 14:23:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-condition-in-a-call-symput/m-p/641630#M191268</guid>
      <dc:creator>unison</dc:creator>
      <dc:date>2020-04-21T14:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: IF condition in a 'call symput'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-condition-in-a-call-symput/m-p/641633#M191270</link>
      <description>&lt;P&gt;The main issue is that macro triggers are not evaluated inside strings that are quoted by single quote characters instead of double quote characters.&amp;nbsp; So you are comparing Monday to &amp;amp;giorno instead of the value of the GIORNO.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also you can simply by using the newer (10+ years old?) CALL SYMPUTX() instead of the older CALL SYMPUT().&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_ ;
  call symputx('giorno',put(today(),DOWNAME.));
run;
data _null_;
  date=today()-1;
  if "&amp;amp;girono" eq 'Monday' then date=date-2;
  call symputx('data_estrazione_3',put(date,date9.));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Apr 2020 14:43:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-condition-in-a-call-symput/m-p/641633#M191270</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-21T14:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: IF condition in a 'call symput'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-condition-in-a-call-symput/m-p/641635#M191271</link>
      <description>&lt;P&gt;There's really no need to create macro variable &amp;amp;giorno in this situation. The WEEKDAY() function eliminates the need for &amp;amp;giorno. That would also simplify the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  if weekday(today())=2 then date=today()-3;
  else date=today()-1;
  call symputx('data_estrazione_3',put(date,date9.));
run;

%put&amp;nbsp;&amp;amp;=data_estrazione_3;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Apr 2020 14:48:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-condition-in-a-call-symput/m-p/641635#M191271</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-21T14:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: IF condition in a 'call symput'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-condition-in-a-call-symput/m-p/641664#M191291</link>
      <description>Many Thanks !!!  I know I'm not so good in SAS!!!  But I have your help !!!&lt;BR /&gt;Have a nice afternoon !!&lt;BR /&gt;Tecla &lt;BR /&gt;</description>
      <pubDate>Tue, 21 Apr 2020 16:20:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-condition-in-a-call-symput/m-p/641664#M191291</guid>
      <dc:creator>Tecla1</dc:creator>
      <dc:date>2020-04-21T16:20:52Z</dc:date>
    </item>
  </channel>
</rss>

