<?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 How to automate date in both Date9. and yymmdd10. in data step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-date-in-both-Date9-and-yymmdd10-in-data-step/m-p/615676#M180103</link>
    <description>&lt;P&gt;I need to automate the date by only having the user to hard code the year and month. The below program works perfectly fine for the month of 10, 11 and 12 but did not work for month from 1 to 9. I realized this is due to single digit of month instead of double digit. Could anyone help on this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Be noted I&amp;nbsp;use this method to atuomate the date is because in the later of the program, there will be SQL pass through between&amp;nbsp;other databases, so I have to&amp;nbsp;automate the date in both of date9. (‘01nov2019’d) And yymmdd10 (2019-11-01) format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%LET&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; YYYY = 2019; &lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/* year*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%LET&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; MM = 11; &lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*month*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_NULL_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;CURRENT_MONTH = input(cats(&amp;amp;YYYY,&amp;amp;MM,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"01"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;yymmdd8.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;) ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;SASD1 = quote(put(CURRENT_MONTH,&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"'"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;)||&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"D"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;SASD2 = quote(put(intnx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'MONTH'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,CURRENT_MONTH,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; ,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"E"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"'"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;)||&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"D"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;SQLD1 = quote(put(CURRENT_MONTH,&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;yymmdd10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"'"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;) ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;SQLD2 = quote(put(intnx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'MONTH'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,CURRENT_MONTH,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; ,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"E"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;yymmdd10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"'"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;) ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CALL&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SYMPUT(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'SASD1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,SASD1);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CALL&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SYMPUT(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'SASD2'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,SASD2);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CALL&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SYMPUT(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'SQLD1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,SQLD1);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CALL&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SYMPUT(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'SQLD2'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,SQLD2);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%PUT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;SASD1 &amp;amp;SASD2 &amp;amp;SQLD1 &amp;amp;SQLD2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%PUT &amp;amp;SASD1 &amp;amp;SASD2 &amp;amp;SQLD1 &amp;amp;SQLD2;&lt;/P&gt;&lt;P&gt;'01NOV2019'D&lt;/P&gt;&lt;P&gt;'30NOV2019'D&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'2019-11-01'&lt;/P&gt;&lt;P&gt;'2019-11-30'&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jan 2020 14:53:19 GMT</pubDate>
    <dc:creator>LL5</dc:creator>
    <dc:date>2020-01-07T14:53:19Z</dc:date>
    <item>
      <title>How to automate date in both Date9. and yymmdd10. in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-date-in-both-Date9-and-yymmdd10-in-data-step/m-p/615676#M180103</link>
      <description>&lt;P&gt;I need to automate the date by only having the user to hard code the year and month. The below program works perfectly fine for the month of 10, 11 and 12 but did not work for month from 1 to 9. I realized this is due to single digit of month instead of double digit. Could anyone help on this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Be noted I&amp;nbsp;use this method to atuomate the date is because in the later of the program, there will be SQL pass through between&amp;nbsp;other databases, so I have to&amp;nbsp;automate the date in both of date9. (‘01nov2019’d) And yymmdd10 (2019-11-01) format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%LET&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; YYYY = 2019; &lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/* year*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%LET&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; MM = 11; &lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*month*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_NULL_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;CURRENT_MONTH = input(cats(&amp;amp;YYYY,&amp;amp;MM,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"01"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;yymmdd8.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;) ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;SASD1 = quote(put(CURRENT_MONTH,&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"'"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;)||&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"D"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;SASD2 = quote(put(intnx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'MONTH'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,CURRENT_MONTH,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; ,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"E"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"'"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;)||&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"D"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;SQLD1 = quote(put(CURRENT_MONTH,&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;yymmdd10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"'"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;) ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;SQLD2 = quote(put(intnx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'MONTH'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,CURRENT_MONTH,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; ,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"E"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;yymmdd10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"'"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;) ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CALL&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SYMPUT(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'SASD1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,SASD1);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CALL&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SYMPUT(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'SASD2'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,SASD2);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CALL&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SYMPUT(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'SQLD1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,SQLD1);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CALL&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SYMPUT(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'SQLD2'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,SQLD2);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%PUT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;SASD1 &amp;amp;SASD2 &amp;amp;SQLD1 &amp;amp;SQLD2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%PUT &amp;amp;SASD1 &amp;amp;SASD2 &amp;amp;SQLD1 &amp;amp;SQLD2;&lt;/P&gt;&lt;P&gt;'01NOV2019'D&lt;/P&gt;&lt;P&gt;'30NOV2019'D&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'2019-11-01'&lt;/P&gt;&lt;P&gt;'2019-11-30'&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2020 14:53:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-date-in-both-Date9-and-yymmdd10-in-data-step/m-p/615676#M180103</guid>
      <dc:creator>LL5</dc:creator>
      <dc:date>2020-01-07T14:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate date in both Date9. and yymmdd10. in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-date-in-both-Date9-and-yymmdd10-in-data-step/m-p/615681#M180105</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/89004"&gt;@LL5&lt;/a&gt;&amp;nbsp; &amp;nbsp;I wonder how your code worked perfectly fine without quotes around macro variable references within CATS? Well of course CATS does an autoconverson to char with best format, so &amp;amp;yyyy or &amp;amp;mm didn't impact. However the numeric resolution is a problem as 01 would become 1.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CURRENT_MONTH = input(cats(&amp;amp;YYYY,&amp;amp;MM,"01"),yymmdd8.) ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, ideally the below should address the issue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CURRENT_MONTH = input(cats("&amp;amp;YYYY","&amp;amp;MM","01"),yymmdd8.) ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So, with this change,your single digit month value can be assigned into your variables like the below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
%LET YYYY = 2019; /* year*/

%LET MM = 01; /*month*/&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2020 15:14:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-date-in-both-Date9-and-yymmdd10-in-data-step/m-p/615681#M180105</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-01-07T15:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate date in both Date9. and yymmdd10. in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-date-in-both-Date9-and-yymmdd10-in-data-step/m-p/615694#M180112</link>
      <description>&lt;P&gt;Thank you novinosrin, I did not pay attention to the quotes and now with your solution&amp;nbsp;it works well. Thanks again.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2020 15:28:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-date-in-both-Date9-and-yymmdd10-in-data-step/m-p/615694#M180112</guid>
      <dc:creator>LL5</dc:creator>
      <dc:date>2020-01-07T15:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate date in both Date9. and yymmdd10. in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-date-in-both-Date9-and-yymmdd10-in-data-step/m-p/615696#M180114</link>
      <description>&lt;P&gt;You ought to stop working with calendar dates as text strings. This causes no end of problems. YOu need to work with&amp;nbsp; calendar dates as SAS dates, and then format them to look properly to humans.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET YYYY = 2019; /* year*/
%LET MM = 11; /*month*/
DATA _NULL_;
    CURRENT_MONTH = mdy(&amp;amp;mm,1,&amp;amp;yyyy);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now all your PUT() function calls are unnecessary, and appending a "d" on the end of the string is unnecessary, there is no need to put quotes around anything (and so you can't mess that up) and the result is much cleaner and much more efficient and readable code.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2020 15:50:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-date-in-both-Date9-and-yymmdd10-in-data-step/m-p/615696#M180114</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-01-07T15:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate date in both Date9. and yymmdd10. in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-date-in-both-Date9-and-yymmdd10-in-data-step/m-p/615699#M180115</link>
      <description>&lt;P&gt;You should probably just use the MDY() function to convert your year and month to a date. Since they take numeric inputs leading zeros are not needed.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CURRENT_MONTH = mdy(&amp;amp;YYYY,&amp;amp;MM,1) ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jan 2020 15:38:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-date-in-both-Date9-and-yymmdd10-in-data-step/m-p/615699#M180115</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-07T15:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate date in both Date9. and yymmdd10. in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-date-in-both-Date9-and-yymmdd10-in-data-step/m-p/615716#M180123</link>
      <description>&lt;P&gt;Thanks Tom. This approach worked well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%LET&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; YYYY = 2020; &lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/* year*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%LET&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; MM = 01; &lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*month*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_NULL_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;CURRENT_MONTH1 = mdy(&amp;amp;mm,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&amp;amp;yyyy);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;D1 = CURRENT_MONTH1;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;D2 = intnx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'MONTH'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,CURRENT_MONTH1 ,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; ,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"E"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CALL&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SYMPUT(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'D1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,D1);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CALL&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SYMPUT(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'D2'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,D2);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; TEST;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;A = PUT(&amp;amp;D1, &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;DATE9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;B = PUT(&amp;amp;D2, &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;DATE9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;C = PUT(&amp;amp;D1, &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;YYMMDD10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;D = PUT(&amp;amp;D2, &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;YYMMDD10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2020 16:25:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-date-in-both-Date9-and-yymmdd10-in-data-step/m-p/615716#M180123</guid>
      <dc:creator>LL5</dc:creator>
      <dc:date>2020-01-07T16:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate date in both Date9. and yymmdd10. in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-date-in-both-Date9-and-yymmdd10-in-data-step/m-p/615717#M180124</link>
      <description>&lt;P&gt;Thanks PaigeMiller. This method works well down the road. Also thanks for letting me know D is not necessary after the date.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2020 16:27:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-date-in-both-Date9-and-yymmdd10-in-data-step/m-p/615717#M180124</guid>
      <dc:creator>LL5</dc:creator>
      <dc:date>2020-01-07T16:27:04Z</dc:date>
    </item>
  </channel>
</rss>

