<?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 two numeric variables to make a Monyyyy Date? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511228#M2138</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83078"&gt;@SuryaKiran&lt;/a&gt;&amp;nbsp; You wrote-- "&lt;SPAN&gt;The log will show the notes because your are trying to concatenate numeric values, so SAS will &lt;STRONG&gt;automaticallly convert&lt;/STRONG&gt; numeric values to character with best. format&lt;/SPAN&gt;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No, &lt;STRONG&gt;cat family of functions does not write any such auto conversion notes&lt;/STRONG&gt; in the sas log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;only the best way&lt;/STRONG&gt; is to use MDY() function?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Wait until what the OP wants in his/her final result before assuming what is the best way although mdy is very straight forward, that I completely agree. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Nevertheless, we are not sure of OP's expected output-&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;should it revert to first of month, end or whatever, does that OP want a resulting character? OP needs to provide more info&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Nov 2018 22:53:21 GMT</pubDate>
    <dc:creator>Allaluiah</dc:creator>
    <dc:date>2018-11-07T22:53:21Z</dc:date>
    <item>
      <title>Combining two numeric variables to make a Monyyyy Date?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511199#M2132</link>
      <description>&lt;P&gt;I have been messing around with this for nearly 20 minutes now and looking up several other threads. I am sure you experienced SAS users are about done with date questions, but can some explain what is wrong with my code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data BMI_DOB;
	Set BMI_year;
	DOB = INPUT(catx(DOB_M, DOB_Y), date7.);
	format DOB date7.;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Why is it converting them to character values rather than dates?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;22         GOPTIONS ACCESSIBLE;
23         Data BMI_DOB;
24         	Set BMI_year;
25         	DOB = INPUT(catx(DOB_M, DOB_Y), date7.);
26         	format DOB date7.;
27         run;

NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
      25:19   
NOTE: Invalid argument to function INPUT at line 25 column 8.
ID=1 Gender=2 DOB_M=9 DOB_Y=1981 Race=4 Year=1997 Height=67 Weight=145 BMI=22.707730007 DOB=. _ERROR_=1 _N_=1
NOTE: Invalid argument to function INPUT at line 25 column 8.
ID=1 Gender=2 DOB_M=9 DOB_Y=1981 Race=4 Year=1998 Height=67 Weight=150 BMI=23.490755179 DOB=. _ERROR_=1 _N_=2
NOTE: Invalid argument to function INPUT at line 25 column 8.
ID=1 Gender=2 DOB_M=9 DOB_Y=1981 Race=4 Year=1999 Height=67 Weight=150 BMI=23.490755179 DOB=. _ERROR_=1 _N_=3
NOTE: Invalid argument to function INPUT at line 25 column 8.
ID=1 Gender=2 DOB_M=9 DOB_Y=1981 Race=4 Year=2000 Height=68 Weight=160 BMI=24.325259516 DOB=. _ERROR_=1 _N_=4
NOTE: Invalid argument to function INPUT at line 25 column 8.
ID=1 Gender=2 DOB_M=9 DOB_Y=1981 Race=4 Year=2001 Height=67 Weight=163 BMI=25.526620628 DOB=. _ERROR_=1 _N_=5
NOTE: Invalid argument to function INPUT at line 25 column 8.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 21:20:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511199#M2132</guid>
      <dc:creator>joebacon</dc:creator>
      <dc:date>2018-11-07T21:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two numeric variables to make a Monyyyy Date?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511203#M2133</link>
      <description>&lt;P&gt;I should add so you don't have to search the code that DOB_M is a numeric value 1-12 representing Month and DOB_Y is a 4 character numeric value representing year.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 21:26:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511203#M2133</guid>
      <dc:creator>joebacon</dc:creator>
      <dc:date>2018-11-07T21:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two numeric variables to make a Monyyyy Date?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511209#M2134</link>
      <description>&lt;P&gt;Are you after this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
do month=1 to 12;
	year=2018;
	output;
end;
run;

data want;
set have;
want=input(cats(year,month),yymmn6.);
format want date9.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Nov 2018 21:48:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511209#M2134</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-11-07T21:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two numeric variables to make a Monyyyy Date?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511220#M2136</link>
      <description>&lt;P&gt;The first argument to the catx function is a separator string to be inserted between concatenated parts. DOB_M being the separator, that leaves only DOB_Y as a string to be concatenated;&amp;nbsp;DOB_M will not be used.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 22:37:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511220#M2136</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-11-07T22:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two numeric variables to make a Monyyyy Date?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511225#M2137</link>
      <description>&lt;P&gt;-&amp;nbsp;&amp;nbsp;Your using CATX() function with in appropriate arguments. CATX(delimiter, item1,item2....) first argument is treated as delimiter. You&amp;nbsp; &amp;nbsp; &amp;nbsp; just need CATS() instead.&lt;/P&gt;
&lt;P&gt;- SAS will automaticallly convert numeric values to character with best. format if arguments to CAT functions are numeric.&lt;/P&gt;
&lt;P&gt;- Notes are generated because values and format for INPUT() function doesn't match.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to suppress this kind of notes then don't print them in log by setting&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;options errors=0;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Since you have month and year only the best way is to use MDY() function, if you don't have day value simply put some dummy and use the format of month and year in which you need.&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
want=mdy(dob_m,01,dob_y);
format want monyy7.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 14:20:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511225#M2137</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-11-08T14:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two numeric variables to make a Monyyyy Date?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511228#M2138</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83078"&gt;@SuryaKiran&lt;/a&gt;&amp;nbsp; You wrote-- "&lt;SPAN&gt;The log will show the notes because your are trying to concatenate numeric values, so SAS will &lt;STRONG&gt;automaticallly convert&lt;/STRONG&gt; numeric values to character with best. format&lt;/SPAN&gt;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No, &lt;STRONG&gt;cat family of functions does not write any such auto conversion notes&lt;/STRONG&gt; in the sas log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;only the best way&lt;/STRONG&gt; is to use MDY() function?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Wait until what the OP wants in his/her final result before assuming what is the best way although mdy is very straight forward, that I completely agree. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Nevertheless, we are not sure of OP's expected output-&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;should it revert to first of month, end or whatever, does that OP want a resulting character? OP needs to provide more info&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 22:53:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511228#M2138</guid>
      <dc:creator>Allaluiah</dc:creator>
      <dc:date>2018-11-07T22:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two numeric variables to make a Monyyyy Date?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511233#M2140</link>
      <description>Regardless of what OP wants day to be, MDY is likely more efficient due to the use of less functions.</description>
      <pubDate>Wed, 07 Nov 2018 23:04:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511233#M2140</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-07T23:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two numeric variables to make a Monyyyy Date?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511365#M2155</link>
      <description>&lt;P&gt;Agree, thanks for pointing that out&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/48036"&gt;@Allaluiah&lt;/a&gt;. Although SAS will automatically converts with best. format no notes is generated. Probably the notes is generated by invalid arguments to&amp;nbsp; INPUT() function.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 13:44:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511365#M2155</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-11-08T13:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two numeric variables to make a Monyyyy Date?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511382#M2158</link>
      <description>Thank you for this! When I do something incorrectly, I like to know why- you gave me just that!&lt;BR /&gt;</description>
      <pubDate>Thu, 08 Nov 2018 14:15:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511382#M2158</guid>
      <dc:creator>joebacon</dc:creator>
      <dc:date>2018-11-08T14:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two numeric variables to make a Monyyyy Date?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511384#M2159</link>
      <description>I was thinking about doing this with a dummy variable like you said. I don't know why I didn't try.&lt;BR /&gt;&lt;BR /&gt;Thank you! This is exactly what I was looking for.&lt;BR /&gt;&lt;BR /&gt;May I ask if you see this, is my code correct beside the catx? I could do the same thing with cats? I am going to look up the cat family.&lt;BR /&gt;&lt;BR /&gt;Thanks again.</description>
      <pubDate>Thu, 08 Nov 2018 14:17:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511384#M2159</guid>
      <dc:creator>joebacon</dc:creator>
      <dc:date>2018-11-08T14:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two numeric variables to make a Monyyyy Date?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511390#M2160</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83078"&gt;@SuryaKiran&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/48036"&gt;@Allaluiah&lt;/a&gt;&amp;nbsp; It's very trivial, the question, the discussion about autoconversion.etc imo. Best bet is to&amp;nbsp;test and confirm . &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are some functions/concepts like within hash/app that do not auto convert and no notes but just an incorrect output and error. However that is something beyond the scope of this thread anyway&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 14:31:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combining-two-numeric-variables-to-make-a-Monyyyy-Date/m-p/511390#M2160</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-11-08T14:31:16Z</dc:date>
    </item>
  </channel>
</rss>

