<?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: need help in date fuction in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/need-help-in-date-fuction/m-p/83171#M23849</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how would you like the result? - a list in the SASlog, a comma separated list in a macro variable, an output report or a SAS dataset?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Jan 2013 08:36:25 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2013-01-23T08:36:25Z</dc:date>
    <item>
      <title>need help in date fuction</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/need-help-in-date-fuction/m-p/83170#M23848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can we get the dates of all sunday for given year??????&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 04:59:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/need-help-in-date-fuction/m-p/83170#M23848</guid>
      <dc:creator>Aman4SAS</dc:creator>
      <dc:date>2013-01-23T04:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: need help in date fuction</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/need-help-in-date-fuction/m-p/83171#M23849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how would you like the result? - a list in the SASlog, a comma separated list in a macro variable, an output report or a SAS dataset?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 08:36:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/need-help-in-date-fuction/m-p/83171#M23849</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2013-01-23T08:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: need help in date fuction</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/need-help-in-date-fuction/m-p/83172#M23850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's a simple piece of code that creates a dataset of all Sundays in a year.&amp;nbsp; The 'week' interval in the INTNX function returns Sunday by default.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let rpt_yr=2012;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data sundays_&amp;amp;rpt_yr.;&lt;/P&gt;&lt;P&gt;format sunday_date date9.;&lt;/P&gt;&lt;P&gt;do i=0 to 52;&lt;/P&gt;&lt;P&gt;sunday_date=intnx('week',"01Jan&amp;amp;rpt_yr."d,i);&lt;/P&gt;&lt;P&gt;if year(sunday_date)=&amp;amp;rpt_yr. then output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;drop i;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 10:55:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/need-help-in-date-fuction/m-p/83172#M23850</guid>
      <dc:creator>Keith</dc:creator>
      <dc:date>2013-01-23T10:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: need help in date fuction</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/need-help-in-date-fuction/m-p/83173#M23851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for ur help sir,, but i m looking for not specific sunday,, any of day of week, like it can b monday ,, i can be friday,, n i m looking result in list view, not together sperated by comma,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 11:05:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/need-help-in-date-fuction/m-p/83173#M23851</guid>
      <dc:creator>Aman4SAS</dc:creator>
      <dc:date>2013-01-23T11:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: need help in date fuction</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/need-help-in-date-fuction/m-p/83174#M23852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Keith,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A very good code to get all the dates in a year. very well executed. Appreciable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Aman4sas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Keith has given a very good code, just make few changes to the code and it will work the way you want. As per your latest post, you wanted to pull any weekday from the given year. i have made few minor changes to Keith code. like i added an additional macro variable weekday, where you can give the number of the weekday for which you want to get the date (like 1 for sunday,2 for monday etc.,) and changes the do loop to list the days in a year. here i used 2 to retrieve the dates of weekday monday (2). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let rpt_yr=2012;&lt;/P&gt;&lt;P&gt;%let weekday=2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data sundays_&amp;amp;rpt_yr.;&lt;/P&gt;&lt;P&gt;format sunday_date date9.;&lt;/P&gt;&lt;P&gt;do i=0 to 366;&lt;/P&gt;&lt;P&gt;sunday_date=intnx('day',"01Jan&amp;amp;rpt_yr."d,i);&lt;/P&gt;&lt;P&gt;if weekday(sunday_date)=&amp;amp;weekday. then output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;drop i;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jagadish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 11:23:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/need-help-in-date-fuction/m-p/83174#M23852</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2013-01-23T11:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: need help in date fuction</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/need-help-in-date-fuction/m-p/83175#M23853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi , its nice logic,, n its not near by actually its exact result what i was looking for,,&lt;/P&gt;&lt;P&gt;thanks for ur help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i beg ur pardon to ask one more ques,, that what is the use of &lt;STRONG&gt;.(dot) &lt;/STRONG&gt;which u use after macro variable..as i never used . for that, and it does same work with using &lt;STRONG&gt;.(dot)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;%let rpt_yr=2012;&lt;/P&gt;&lt;P&gt;%let weekday=2;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data sundays_&amp;amp;rpt_yr.;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;gt; . after rpt_yr&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;format sunday_date date9.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;do i=0 to 366;&lt;/P&gt;&lt;P&gt;sunday_date=intnx('day',"01Jan&amp;amp;rpt_yr."d,i);&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;-&amp;gt; . after rpt_yr&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;if weekday(sunday_date)=&amp;amp;weekday. then output;&amp;nbsp; &lt;STRONG&gt;-&amp;gt; . after weekday&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;drop i;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i m realy sorry if u thnk its silly que,, but i m realy confused abt it,. what is the logic behind it,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 12:34:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/need-help-in-date-fuction/m-p/83175#M23853</guid>
      <dc:creator>Aman4SAS</dc:creator>
      <dc:date>2013-01-23T12:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: need help in date fuction</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/need-help-in-date-fuction/m-p/83176#M23854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you are using a single macro variable like &amp;amp;rpt_yr then there is no need for you to put any . after the macro variable when you use it. it will work with the .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but there will be scenarios when you will use macro variable before the name of the variable like for example, in those situations if you dont use the . after the macro variable, it will consider the entire name as macro variable and it will search for that macro variable, to avoid that we use . after macro variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope the below example will help you to understand it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data xname;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set sashelp.class;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let name=x;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=&amp;amp;name.name;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Jagadish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 13:05:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/need-help-in-date-fuction/m-p/83176#M23854</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2013-01-23T13:05:57Z</dc:date>
    </item>
  </channel>
</rss>

