<?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 Date time functions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-time-functions/m-p/17453#M2539</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 I have a set date, and want to create date variables that are, 1 month, 2 month 6 month before that set date, is there a function that will be able to get me that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example: &lt;/P&gt;&lt;P&gt;set_date = 12DEC11 &lt;/P&gt;&lt;P&gt;i want to create a new var with date 1 month before the set_date:&lt;/P&gt;&lt;P&gt;set_date_last_1mth = 12NOV11 ;&lt;/P&gt;&lt;P&gt;2 months:&lt;/P&gt;&lt;P&gt;set_date_last_2mth = 12OCT11 ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is there a simple way to do this?&lt;/P&gt;&lt;P&gt;currently I use set_date_last_1mth = set_date - 30 ; -60 -120 etc. which isnt entirely accurate or the best way to do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Dec 2011 17:29:38 GMT</pubDate>
    <dc:creator>Danglytics</dc:creator>
    <dc:date>2011-12-19T17:29:38Z</dc:date>
    <item>
      <title>Date time functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-time-functions/m-p/17453#M2539</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 I have a set date, and want to create date variables that are, 1 month, 2 month 6 month before that set date, is there a function that will be able to get me that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example: &lt;/P&gt;&lt;P&gt;set_date = 12DEC11 &lt;/P&gt;&lt;P&gt;i want to create a new var with date 1 month before the set_date:&lt;/P&gt;&lt;P&gt;set_date_last_1mth = 12NOV11 ;&lt;/P&gt;&lt;P&gt;2 months:&lt;/P&gt;&lt;P&gt;set_date_last_2mth = 12OCT11 ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is there a simple way to do this?&lt;/P&gt;&lt;P&gt;currently I use set_date_last_1mth = set_date - 30 ; -60 -120 etc. which isnt entirely accurate or the best way to do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Dec 2011 17:29:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-time-functions/m-p/17453#M2539</guid>
      <dc:creator>Danglytics</dc:creator>
      <dc:date>2011-12-19T17:29:38Z</dc:date>
    </item>
    <item>
      <title>Date time functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-time-functions/m-p/17454#M2540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Have you explored the INTNX function yet? There are lots of examples in the online help that look like what your are attempting.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Dec 2011 17:45:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-time-functions/m-p/17454#M2540</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2011-12-19T17:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: Date time functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-time-functions/m-p/350455#M81462</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are the &lt;A href="https://sascertified.wordpress.com/sas-functions/" target="_blank"&gt;functions&lt;/A&gt; used to process &lt;A href="https://sascertified.wordpress.com/sas-functions/" target="_blank"&gt;date and time values.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For&amp;nbsp;Example:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data date_functions;&lt;BR /&gt;INPUT @1 date1 date9. &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/30987"&gt;@11&lt;/a&gt;&amp;nbsp;date2 date9.;&lt;BR /&gt;format date1 date9. date2 date9.;&lt;/P&gt;&lt;P&gt;/* Get the interval between the dates in years*/&lt;BR /&gt;Years_ = INTCK(‘YEAR’,date1,date2);&lt;/P&gt;&lt;P&gt;/* Get the interval between the dates in months*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;List of SAS Exam and its online practice exams&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.analyticsexam.com/sas-foundation-certification/sas-certified-base-programmer" target="_blank"&gt;&lt;STRONG&gt;SAS Certified Base Programmer for SAS 9&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.analyticsexam.com/sas-foundation-certification/sas-certified-advanced-programmer" target="_self"&gt;SAS Certified Advanced Programmer for SAS 9&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.analyticsexam.com/sas-certification/a00-280-sas-certified-clinical-trials-programmer-using-sas-9" target="_blank"&gt;&lt;SPAN&gt;&lt;STRONG&gt;SAS Certified Clinical Trials Programmer Using SAS 9&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.analyticsexam.com/sas-certification/a00-281-sas-certified-clinical-trials-programmer-using-sas-9-accelerated-version" target="_blank"&gt;&lt;STRONG&gt;SAS Certified Clinical Trials Programmer Using SAS 9&amp;nbsp;- Accelerated Version&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.analyticsexam.com/sas-advanced-analytics-certification/sas-certified-statistical-business-analyst" target="_blank"&gt;&lt;STRONG&gt;SAS Certified Statistical Business Analyst Using SAS 9&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.analyticsexam.com/other-sas-certification/sas-certified-bi-content-developer" target="_blank"&gt;&lt;STRONG&gt;SAS Certified BI Content Developer for SAS 9&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.analyticsexam.com/other-sas-certification/sas-certified-data-integration-developer" target="_blank"&gt;&lt;STRONG&gt;SAS Certified Data Integration Developer for SAS 9&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.analyticsexam.com/other-sas-certification/sas-certified-platform-administrator" target="_blank"&gt;&lt;STRONG&gt;SAS Certified Platform Administrator for SAS 9&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.analyticsexam.com/sas-certification/a00-220-sas-big-data-preparation-statistics-and-visual-exploration" target="_blank"&gt;&lt;STRONG&gt;&lt;SPAN&gt;SAS Big Data Preparation, Statistics, and Visual Exploration Using SAS 9&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.analyticsexam.com/sas-certification/a00-221-sas-big-data-programming-and-loading" target="_blank"&gt;&lt;STRONG&gt;&lt;SPAN&gt;SAS Big Data Programming and Loading&amp;nbsp;Using SAS 9&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.analyticsexam.com/sas-certification/a00-225-sas-advanced-predictive-modeling" target="_self"&gt;&lt;SPAN&gt;SAS Advanced Predictive Modeling Using SAS 9&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.analyticsexam.com/sas-certification/a00-226-sas-text-analytics-time-series-experimentation-and-optimization" target="_blank"&gt;&lt;STRONG&gt;&lt;SPAN&gt;SAS Text Analytics, Time Series, Experimentation and Optimization using SAS 9&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.analyticsexam.com/sas-certification/a00-255-sas-predictive-modeling-using-sas-enterprise-miner-14" target="_blank"&gt;&lt;STRONG&gt;&lt;SPAN&gt;A00-255: SAS Predictive Modeling Using SAS Enterprise Miner 14&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.analyticsexam.com/sas-certification/a00-277-sas-visual-analytics-exploration-and-design" target="_blank"&gt;&lt;SPAN&gt;&lt;STRONG&gt;A00-277: SAS Visual Analytics Exploration and Design&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.analyticsexam.com/sas-certification/a00-262-sas-certified-data-quality-steward-sas-9" target="_blank"&gt;&lt;STRONG&gt;&lt;SPAN&gt;A00-262: SAS Certified Data Quality Steward for SAS 9&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.analyticsexam.com/sas-certification/a00-272-sas-certified-visual-modeler-using-sas-visual-statistics-74" target="_blank"&gt;&lt;SPAN&gt;&lt;STRONG&gt;A00-272: SAS Certified Visual Modeler Using SAS Visual Statistics 7.4&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;months_ = INTCK(‘MONTH’,date1,date2);&lt;/P&gt;&lt;P&gt;/* Get the week day from the date*/&lt;BR /&gt;weekday_ = WEEKDAY(date1);&lt;/P&gt;&lt;P&gt;/* Get Today’s date in SAS date format */&lt;BR /&gt;today_ = TODAY();&lt;/P&gt;&lt;P&gt;/* Get current time in SAS time format */&lt;BR /&gt;time_ = time();&lt;BR /&gt;DATALINES;&lt;BR /&gt;21OCT2000 16AUG1998&lt;BR /&gt;01MAR2009 11JUL2012&lt;BR /&gt;;&lt;BR /&gt;proc print data = date_functions noobs;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Output:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="date_time_funcs_result.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/8344i9F3D2EF7A82C69B3/image-size/large?v=v2&amp;amp;px=999" role="button" title="date_time_funcs_result.jpg" alt="date_time_funcs_result.jpg" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 May 2018 11:17:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-time-functions/m-p/350455#M81462</guid>
      <dc:creator>EronitaScott</dc:creator>
      <dc:date>2018-05-08T11:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: Date time functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-time-functions/m-p/350460#M81465</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please use beow code to resolve your query in most efficient way:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; out1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;set_date = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;'12dec2011'd&lt;/FONT&gt;&lt;/STRONG&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;set_date_last_1mth = intnx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'month'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,set_date,-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'s'&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;set_date_last_2mth = intnx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'month'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,set_date,-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'s'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; set_date set_date_last_1mth set_date_last_2mth &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;ddmmyy10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;I hope it helps. Thanks.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2017 09:43:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-time-functions/m-p/350460#M81465</guid>
      <dc:creator>SAS_007</dc:creator>
      <dc:date>2017-04-17T09:43:08Z</dc:date>
    </item>
  </channel>
</rss>

