<?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 Sunday for every year 1st JAN in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851574#M336590</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds (drop=st  ed);
do date='01jan1970'd to '01jan2023'd  by 12 ;
if weekday(date)=1 then output;
end;
format date date9.;
w=put(i,downame.);
proc print ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Herer i am trying to get 1st Jan&amp;nbsp; comes in sundays for given date range&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;requiried output&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1978, 1989, 1995, 2006, 2017, and 2023 years&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1st Jan comes in suday&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Dec 2022 05:59:25 GMT</pubDate>
    <dc:creator>BrahmanandaRao</dc:creator>
    <dc:date>2022-12-30T05:59:25Z</dc:date>
    <item>
      <title>Sunday for every year 1st JAN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851574#M336590</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds (drop=st  ed);
do date='01jan1970'd to '01jan2023'd  by 12 ;
if weekday(date)=1 then output;
end;
format date date9.;
w=put(i,downame.);
proc print ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Herer i am trying to get 1st Jan&amp;nbsp; comes in sundays for given date range&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;requiried output&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1978, 1989, 1995, 2006, 2017, and 2023 years&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1st Jan comes in suday&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2022 05:59:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851574#M336590</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2022-12-30T05:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: Sunday for every year 1st JAN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851577#M336591</link>
      <description>&lt;P&gt;And the question is?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2022 07:01:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851577#M336591</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-12-30T07:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: Sunday for every year 1st JAN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851586#M336596</link>
      <description>I want get which years 1st Jan  come sundays  given date range</description>
      <pubDate>Fri, 30 Dec 2022 08:30:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851586#M336596</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2022-12-30T08:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Sunday for every year 1st JAN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851587#M336597</link>
      <description>&lt;P&gt;Dates are&amp;nbsp;counts of&amp;nbsp;&lt;STRONG&gt;days&lt;/STRONG&gt;, not counts of&amp;nbsp;&lt;STRONG&gt;months&lt;/STRONG&gt;. That's why BY 12 can't work.&lt;/P&gt;
&lt;P&gt;Instead of an iterative DO loop, use a DO WHILE and the INTNX function to increment.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2022 08:33:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851587#M336597</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-12-30T08:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: Sunday for every year 1st JAN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851588#M336598</link>
      <description>&lt;P&gt;Here's one way to approach that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  do year = 1970 to 2023;
      jan1 = mdy(1, 1, year);
      if weekday(jan1) = 1 then output;
   end;
   format jan1 date9.;&lt;BR /&gt;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Dec 2022 08:35:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851588#M336598</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-12-30T08:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: Sunday for every year 1st JAN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851591#M336600</link>
      <description>&lt;P&gt;Consider just using the date of interest, 1 Jan for each year.&lt;/P&gt;
&lt;PRE&gt;data ds ;
do year=1970 to 2023;
  if weekday(mdy(1,1,year)) = 1 then output;
end;
run;&lt;/PRE&gt;
&lt;P&gt;Your do loop by 12 was incrementing by 12 day intervals, not months or years so was pretty far off. And since 12 seldom goes into a year evenly when considering days doesn't hit a 1 Jan date very often.&lt;/P&gt;
&lt;P&gt;The MDY function creates a date value from numeric parameters of Month number, day number and year.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2022 08:39:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851591#M336600</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-12-30T08:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Sunday for every year 1st JAN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851600#M336606</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
 do year=1978 to 2023;
   sunday=nwkdom(1,1,1,year);
   output;
 end;
 format sunday date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Dec 2022 10:44:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851600#M336606</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-12-30T10:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Sunday for every year 1st JAN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851603#M336607</link>
      <description>Thank you Astounding &lt;BR /&gt;your are solved this question</description>
      <pubDate>Fri, 30 Dec 2022 11:01:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851603#M336607</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2022-12-30T11:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Sunday for every year 1st JAN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851604#M336608</link>
      <description>Thank you Sharp&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;  do year = 1960 to 2050;&lt;BR /&gt;      jan1 = mdy(1, 1, year);&lt;BR /&gt;      if weekday(jan1) = 1 then output;&lt;BR /&gt;   end;&lt;BR /&gt;   format jan1 downame.;&lt;BR /&gt;proc print;&lt;BR /&gt;run;&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Dec 2022 11:03:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sunday-for-every-year-1st-JAN/m-p/851604#M336608</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2022-12-30T11:03:04Z</dc:date>
    </item>
  </channel>
</rss>

