<?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: Combining 3 variables into one and converting to date in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513742#M2579</link>
    <description>&lt;P&gt;see the below example . even if you have data in character values this works albite it gives note in log.(first 2 examples work)&lt;/P&gt;
&lt;P&gt;unless some of your does not make date, which cause this issue. check the examples in code below&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
mnth = 1;
d = 2;
yr =2016;
newdate=mdy(mnth,d,yr);
format newdate mmddyy10.;
run;

data want1;
mnth = "1";
d = "2";
yr ="2016";
newdate=mdy(mnth,d,yr);
format newdate mmddyy10.;
run;
/* this will not work because there is 13 as month and result in . and you have note in 
log NOTE: Invalid argument to function MDY(13,2,2016) at line 77 column 9.*/
data want3;
mnth = 13;
d = 2;
yr =2016;
newdate=mdy(mnth,d,yr);
format newdate mmddyy10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Nov 2018 01:47:58 GMT</pubDate>
    <dc:creator>kiranv_</dc:creator>
    <dc:date>2018-11-16T01:47:58Z</dc:date>
    <item>
      <title>Combining 3 variables into one and converting to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513709#M2572</link>
      <description>&lt;P&gt;I need to take three numeric variables, combine into one, then convert to a date.&amp;nbsp; I am using a CATX and am getting a warning I don't understand.&lt;/P&gt;&lt;PRE&gt;data IncurredDate;
set work.AngieClaims;
date=input(catx("/", Mnth, Date, Year), mmddyy10);
format date mmddyy10;
run;&lt;/PRE&gt;&lt;P&gt;Log and input file attached.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 23:17:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513709#M2572</guid>
      <dc:creator>AMMAN</dc:creator>
      <dc:date>2018-11-15T23:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 3 variables into one and converting to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513718#M2574</link>
      <description>&lt;P&gt;just use mdy function&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data IncurredDate;
set work.AngieClaims;
newdate=mdy( Mnth, Date, Year);
format newdate mmddyy10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Nov 2018 23:50:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513718#M2574</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-11-15T23:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 3 variables into one and converting to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513725#M2576</link>
      <description>&lt;P&gt;Thanks for the recommendation.&amp;nbsp; I tried that and got this result.&amp;nbsp; I don't see the combined variable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24979i03571F0B7FE6DEBE/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 23:48:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513725#M2576</guid>
      <dc:creator>AMMAN</dc:creator>
      <dc:date>2018-11-15T23:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 3 variables into one and converting to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513728#M2577</link>
      <description>&lt;P&gt;try making new column name as date and I have updated my answer&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 23:53:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513728#M2577</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-11-15T23:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 3 variables into one and converting to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513735#M2578</link>
      <description>&lt;P&gt;I dropped some vars to clean it up.&amp;nbsp; New var shows up, but it empty&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data IncurredDate (drop=MOS DOS YOS Mnth Date Year) ;
set work.AngieClaims;
newdate=mdy(Mnth, Date, Year);
format newdate mmddyy10.;
run;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 386px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24980iE0EACED7D6502234/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 00:03:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513735#M2578</guid>
      <dc:creator>AMMAN</dc:creator>
      <dc:date>2018-11-16T00:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 3 variables into one and converting to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513742#M2579</link>
      <description>&lt;P&gt;see the below example . even if you have data in character values this works albite it gives note in log.(first 2 examples work)&lt;/P&gt;
&lt;P&gt;unless some of your does not make date, which cause this issue. check the examples in code below&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
mnth = 1;
d = 2;
yr =2016;
newdate=mdy(mnth,d,yr);
format newdate mmddyy10.;
run;

data want1;
mnth = "1";
d = "2";
yr ="2016";
newdate=mdy(mnth,d,yr);
format newdate mmddyy10.;
run;
/* this will not work because there is 13 as month and result in . and you have note in 
log NOTE: Invalid argument to function MDY(13,2,2016) at line 77 column 9.*/
data want3;
mnth = 13;
d = 2;
yr =2016;
newdate=mdy(mnth,d,yr);
format newdate mmddyy10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 01:47:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513742#M2579</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-11-16T01:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 3 variables into one and converting to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513751#M2580</link>
      <description>&lt;P&gt;Ooof,&amp;nbsp; I don't understand your feedback.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 01:33:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513751#M2580</guid>
      <dc:creator>AMMAN</dc:creator>
      <dc:date>2018-11-16T01:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 3 variables into one and converting to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513753#M2581</link>
      <description>&lt;P&gt;did u run the codes. first 2 work if your month, day and year are allowable then mdy code work.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 01:41:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513753#M2581</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-11-16T01:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 3 variables into one and converting to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513782#M2582</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/221595"&gt;@AMMAN&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Ooof,&amp;nbsp; I don't understand your feedback.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Start with reading the log of your program: are there any notes about missing values? The function mdy need three numbers to create a data, if one is missing the result is missing, too. &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37783"&gt;@kiranv_&lt;/a&gt; tried to point to the most likely cause of having missing values: your data.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 05:43:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513782#M2582</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-11-16T05:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 3 variables into one and converting to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513786#M2583</link>
      <description>&lt;P&gt;From the picture you posted your MONTH variable is named MNTH, your DAY variable is named DOS and your YEAR variable is named YOS.&lt;/P&gt;
&lt;P&gt;So the assignment statement you want would be&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;date=mdy(mnth,dos,yos);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It looks like you probably ran this code instead&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;date=mdy(mnth,dos,year);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So SAS created a new variable named YEAR that has all missing values. And also made DATE as missing since you did not provide a year value.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 06:15:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513786#M2583</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-11-16T06:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 3 variables into one and converting to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513862#M2595</link>
      <description>&lt;P&gt;Because you are still trying to use a variable that doesn't exist for the year number.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 13:16:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/513862#M2595</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-11-16T13:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 3 variables into one and converting to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/514058#M2637</link>
      <description>&lt;P&gt;I was confused by the labels.&amp;nbsp; I couldn't understand why it said I was missing values.&amp;nbsp; I was looking at the wrong variable.&amp;nbsp; Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 22:04:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/514058#M2637</guid>
      <dc:creator>AMMAN</dc:creator>
      <dc:date>2018-11-16T22:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 3 variables into one and converting to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/514059#M2638</link>
      <description>&lt;P&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 22:04:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/514059#M2638</guid>
      <dc:creator>AMMAN</dc:creator>
      <dc:date>2018-11-16T22:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 3 variables into one and converting to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/514060#M2639</link>
      <description>&lt;P&gt;Thanks for your help.&amp;nbsp; I was looking at the wrong variable.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 22:05:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-3-variables-into-one-and-converting-to-date/m-p/514060#M2639</guid>
      <dc:creator>AMMAN</dc:creator>
      <dc:date>2018-11-16T22:05:29Z</dc:date>
    </item>
  </channel>
</rss>

