<?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 Concatenate numeric variables into a single mm/yy date? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-numeric-variables-into-a-single-mm-yy-date/m-p/774349#M246107</link>
    <description>&lt;P&gt;I have 2 numeric variables for day and month respectively:&amp;nbsp; DD_LV and MM_LV. I also have a general YY_ variable for year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know I have to turn them into character variables first, but I ultimately want to concatenate them into a single MM/DD/YY date variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What's the most efficient way to approach this?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Oct 2021 20:30:05 GMT</pubDate>
    <dc:creator>SAS93</dc:creator>
    <dc:date>2021-10-14T20:30:05Z</dc:date>
    <item>
      <title>Concatenate numeric variables into a single mm/yy date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-numeric-variables-into-a-single-mm-yy-date/m-p/774349#M246107</link>
      <description>&lt;P&gt;I have 2 numeric variables for day and month respectively:&amp;nbsp; DD_LV and MM_LV. I also have a general YY_ variable for year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know I have to turn them into character variables first, but I ultimately want to concatenate them into a single MM/DD/YY date variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What's the most efficient way to approach this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 20:30:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-numeric-variables-into-a-single-mm-yy-date/m-p/774349#M246107</guid>
      <dc:creator>SAS93</dc:creator>
      <dc:date>2021-10-14T20:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate numeric variables into a single mm/yy date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-numeric-variables-into-a-single-mm-yy-date/m-p/774358#M246108</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/297876"&gt;@SAS93&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know I have to turn them into character variables first, but I ultimately want to concatenate them into a single MM/DD/YY date variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No, you do not &lt;STRONG&gt;have&lt;/STRONG&gt; to turn them into character variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want_date;
mm_lv=10;
dd_lv=14; 
yy_variable = 2020;

date_var_num = mdy(mm_lv, dd_lv, yy_variable);
format date_var_num mmddyy10.;

date_var_char8 = put(date_var_num, mmddyys8.);
date_var_char10 = put(date_var_num, mmddyys10.);

run;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;Obs	mm_lv	dd_lv	yy_variable	date_var_num	date_var_char8	date_var_char10
1	10	14	2020	10/14/2020	10/14/20	10/14/2020&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/297876"&gt;@SAS93&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have 2 numeric variables for day and month respectively:&amp;nbsp; DD_LV and MM_LV. I also have a general YY_ variable for year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know I have to turn them into character variables first, but I ultimately want to concatenate them into a single MM/DD/YY date variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What's the most efficient way to approach this?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 20:36:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-numeric-variables-into-a-single-mm-yy-date/m-p/774358#M246108</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-10-14T20:36:59Z</dc:date>
    </item>
  </channel>
</rss>

