<?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: sas weekday in macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598687#M172672</link>
    <description>whats downname here&lt;BR /&gt;</description>
    <pubDate>Wed, 23 Oct 2019 12:50:19 GMT</pubDate>
    <dc:creator>Srigyan</dc:creator>
    <dc:date>2019-10-23T12:50:19Z</dc:date>
    <item>
      <title>sas weekday in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598683#M172668</link>
      <description>&lt;P&gt;I am trying to assign a weekday in a macro variable.I am getting error. Someone please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
today=date();
day=weekday(today);
call symput('weekday',day);
run;

%put &amp;amp;weekday.;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 12:40:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598683#M172668</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-10-23T12:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: sas weekday in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598684#M172669</link>
      <description>&lt;P&gt;Small correction&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
day=put(weekday(today()), downame.);
call symput('weekday',day);
run;

%put &amp;amp;weekday.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 12:45:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598684#M172669</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-10-23T12:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: sas weekday in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598687#M172672</link>
      <description>whats downname here&lt;BR /&gt;</description>
      <pubDate>Wed, 23 Oct 2019 12:50:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598687#M172672</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-10-23T12:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: sas weekday in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598689#M172674</link>
      <description>Its giving me tuesday, any idea why</description>
      <pubDate>Wed, 23 Oct 2019 12:51:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598689#M172674</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-10-23T12:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: sas weekday in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598692#M172675</link>
      <description>&lt;P&gt;Do this instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
day=put(weekday(today()), downame9.);
call symput('weekday',day);
run;

%put &amp;amp;weekday.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000200842.htm" target="_self"&gt;downame.&lt;/A&gt; is a format.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 12:58:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598692#M172675</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-10-23T12:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: sas weekday in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598693#M172676</link>
      <description>output is Tuesday, today is wednesday</description>
      <pubDate>Wed, 23 Oct 2019 13:01:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598693#M172676</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-10-23T13:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: sas weekday in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598694#M172677</link>
      <description>&lt;P&gt;Sorry, my mistake&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
day=put(weekday(today()+1), downame9.);
call symput('weekday',day);
run;

%put &amp;amp;weekday.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Oct 2019 13:02:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598694#M172677</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-10-23T13:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: sas weekday in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598695#M172678</link>
      <description>Just to know, why _1 is reqired as today() is date for today only</description>
      <pubDate>Wed, 23 Oct 2019 13:04:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598695#M172678</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-10-23T13:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: sas weekday in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598696#M172679</link>
      <description>&lt;P&gt;If you want the weekday to be returned then the solution provided by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp;can be further modified to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   day = put(weekday(today()), weekday.);
   call symput('weekday',day);
run;

%put &amp;amp;weekday.;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;downame is a format that can be used to represent the name of the day based on a date value:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000200842.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000200842.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Similarly, weekday is also a format that writes the day of the week as a number based on a date value:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000200757.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000200757.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 13:04:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598696#M172679</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2019-10-23T13:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: sas weekday in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598697#M172680</link>
      <description>&lt;P&gt;The WEEKDAY() function is not needed here, and causes the problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
call symputx('weekday',put(today(),downame.));
run;

%put &amp;amp;=weekday;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 13:11:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598697#M172680</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-10-23T13:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: sas weekday in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598699#M172682</link>
      <description>&lt;P&gt;Adding&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The DOWNAME format expects a valid SAS date, such as '23OCT19'd; but if you take the output of the WEEKDAY function (which is 4, which is how SAS represents Wednesday) and apply the DOWNAME format to it, then it assumes the 4 means that the date in question is January 5, 1960, and that was apparently a Tuesday.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 13:15:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598699#M172682</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-10-23T13:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: sas weekday in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598700#M172683</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/200312"&gt;@Srigyan&lt;/a&gt;&amp;nbsp; I think what you need is Weekdate9. format&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;9    data _null_;
10   today=date();
11   day=put(today,weekdate9.);
12   call symput('weekday',day);
13   run;

NOTE: DATA statement used (Total process time):
      real time           0.06 seconds
      cpu time            0.00 seconds


14
15   %put &amp;amp;weekday.;
Wednesday
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Oct 2019 13:17:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598700#M172683</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-10-23T13:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: sas weekday in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598712#M172687</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/200312"&gt;@Srigyan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am trying to assign a weekday in a macro variable.I am getting error. Someone please help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
today=date();
day=weekday(today);
call symput('weekday',day);
run;

%put &amp;amp;weekday.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Your code does NOT cause an ERROR, see the log (Maxim 2):&lt;/P&gt;
&lt;PRE&gt; 73         data _null_;
 74         today=date();
 75         day=weekday(today);
 76         call symput('weekday',day);
 77         run;
 
 NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
       76:23   
 NOTE:  Verwendet wurde: DATA statement - (Gesamtverarbeitungszeit):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 78         
 79         %put &amp;amp;weekday.;
 4
 &lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Oct 2019 13:54:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-weekday-in-macro-variable/m-p/598712#M172687</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-23T13:54:42Z</dc:date>
    </item>
  </channel>
</rss>

