<?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: How to read character values to find the value type (Date and its format) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-character-values-to-find-the-value-type-Date-and-its/m-p/783367#M249761</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
value='19990131'; output;
value='12312006'; output;
value='car_0001'; output;
value='blue_001'; output;
run;
data want;
    set test;
    date=input(value,anydtdte.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the value of DATE is missing, then it is not recognized as a SAS date. This method, using informat ANYDTDTE, is not perfect, it won't give you the proper answer 100% of the time.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Dec 2021 11:02:16 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-12-01T11:02:16Z</dc:date>
    <item>
      <title>How to read character values to find the value type (Date and its format)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-character-values-to-find-the-value-type-Date-and-its/m-p/783350#M249759</link>
      <description>&lt;P&gt;I am facing a difficulty whereby I couldn't find a way to read the source character values to determine if it is a date format (possible in YYYYMMDD and MMDDYYYY) or other character format such as car_0001.&lt;BR /&gt;&lt;BR /&gt;Sample as below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data test;

value1='19990131';

value2='12312006';

value3='car_0001';

value4='blue_001';

run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;As we can see from above, each columns have its own value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way that I can identify value 1 as YYYYMMDD, value 2 as MMDDYYYY, or value 3 and 4 as character (nondate)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I couldn't think of a function to do so.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 10:14:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-character-values-to-find-the-value-type-Date-and-its/m-p/783350#M249759</guid>
      <dc:creator>StickyRoll</dc:creator>
      <dc:date>2021-12-01T10:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to read character values to find the value type (Date and its format)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-character-values-to-find-the-value-type-Date-and-its/m-p/783367#M249761</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
value='19990131'; output;
value='12312006'; output;
value='car_0001'; output;
value='blue_001'; output;
run;
data want;
    set test;
    date=input(value,anydtdte.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the value of DATE is missing, then it is not recognized as a SAS date. This method, using informat ANYDTDTE, is not perfect, it won't give you the proper answer 100% of the time.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 11:02:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-character-values-to-find-the-value-type-Date-and-its/m-p/783367#M249761</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-12-01T11:02:16Z</dc:date>
    </item>
  </channel>
</rss>

