<?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: converting character to date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618856#M181599</link>
    <description>&lt;P&gt;Is there any way to control the output of the date as 01.02.2001 or 01-02-2001?&lt;/P&gt;</description>
    <pubDate>Tue, 21 Jan 2020 13:32:59 GMT</pubDate>
    <dc:creator>Anita_n</dc:creator>
    <dc:date>2020-01-21T13:32:59Z</dc:date>
    <item>
      <title>converting character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618845#M181593</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I have a problem. I need to convert a set of character variables to date but it is not working&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input datevar ddmmyy10.;

datalines;
Feb 2001
Mai 2010
Okt 2000
Dez 1998
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;pls note that this is the german abbreviation for the months.&lt;/P&gt;&lt;P&gt;I want the to give me something like 01.02,2001 and so on.&lt;/P&gt;&lt;P&gt;pls I will appreciate any help&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 13:03:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618845#M181593</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2020-01-21T13:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: converting character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618848#M181594</link>
      <description>&lt;P&gt;You need to use the informat MONYY.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can't use DDMMYY10. because no days are provided in the input data.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 13:10:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618848#M181594</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-01-21T13:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: converting character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618849#M181595</link>
      <description>&lt;P&gt;I tried that now and is given me this warning&lt;/P&gt;&lt;P&gt;invalid data for datvar in line 509 1-5&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 13:14:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618849#M181595</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2020-01-21T13:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: converting character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618851#M181596</link>
      <description>&lt;P&gt;monyy won't recognize the German month abbreviations, and I found no suitable informat in the &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=nlsref&amp;amp;docsetTarget=titlepage.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;National Language Support&lt;/A&gt;&amp;nbsp;section of the documentation.&lt;/P&gt;
&lt;P&gt;I would roll me a custom informat for the months,and then use the mdy() function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
invalue mon_deu
  'Jan' = 1
  'Feb' = 2
  'Mär' = 3
  'Apr' = 4
  'Mai' = 5
  'Jun' = 6
  'Jul' = 7
  'Aug' = 8
  'Sep' = 9
  'Okt' = 10
  'Nov' = 11
  'Dez' = 12
;
run;

data test;
input _datevar $8.;
datevar = mdy(input(substr(_datevar,1,3),mon_deu.),1,input(scan(_datevar,2),4.));
format datevar yymmddd10.;
datalines;
Feb 2001
Mai 2010
Okt 2000
Dez 1998
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The "universal" informat anydtdte catches some of the months, but not all ("Mär","Mai","Okt","Dez" would fail).&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 13:21:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618851#M181596</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-21T13:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: converting character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618854#M181597</link>
      <description>&lt;P&gt;It worked for me with English month names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;has a good solution.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 13:28:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618854#M181597</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-01-21T13:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: converting character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618855#M181598</link>
      <description>&lt;P&gt;thank you, it worked&lt;/P&gt;&lt;P&gt;I appreciate that&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 13:30:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618855#M181598</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2020-01-21T13:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: converting character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618856#M181599</link>
      <description>&lt;P&gt;Is there any way to control the output of the date as 01.02.2001 or 01-02-2001?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 13:32:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618856#M181599</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2020-01-21T13:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: converting character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618857#M181600</link>
      <description>&lt;P&gt;Yes. Use the ddmmyy10. (or ddmmyyp10. to get periods) display format.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 13:35:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618857#M181600</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-21T13:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: converting character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618858#M181601</link>
      <description>&lt;P&gt;okay thanks a lot&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 13:36:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618858#M181601</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2020-01-21T13:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: converting character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618860#M181602</link>
      <description>&lt;P&gt;The NLDATE informat should work.&amp;nbsp; You just need to add a day number in the front.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  input datestr $8. ;
  datevar=input('01 ' || datestr, nldate11.);
  format datevar yymmdd10. ;
datalines;
Feb 2001
Mai 2010
Okt 2000
Dez 1998
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Jan 2020 13:36:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618860#M181602</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-21T13:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: converting character to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618862#M181603</link>
      <description>&lt;P&gt;that works also. Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 13:48:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-character-to-date/m-p/618862#M181603</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2020-01-21T13:48:29Z</dc:date>
    </item>
  </channel>
</rss>

