<?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: Reading DATE data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-DATE-data/m-p/442182#M110601</link>
    <description>&lt;P&gt;You seem confused between what an INFORMAT does and what a FORMAT does. An INFORMAT is instructions for how to convert text into the value that is stored. A FORMAT is instructions for how to convert the value that is stored into text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a date variable and you want to print the value in MDY order then use the MMDDYY format.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC PRINT DATA = music; 
  FORMAT ReleaseDate MMDDYY10. ;
RUN; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Of course if you want your friends in the UK to understand it then it might be better to use the YYMMDD format instead as nobody will confuse the value 2018-12-10 as meaning the twelfth of November instead of the tenth of December.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you try using the ANYDTDTE. informat to read your existing CSV file?&lt;/P&gt;
&lt;PRE&gt;data test;
  infile cards dsd truncover firstobs=2 ;
  input Album :$50. Artist :$50. ReleaseDate :ANYDTDTE.
       TotalCertifiedCopies ClaimedSales Genre :$50.
  ;
  format ReleaseDate yymmdd10.;
cards4;
Album,Artist,ReleaseDate,TotalCertifiedCopies,ClaimedSales,Genre
Thriller,Michael Jackson,"November 30, 1982",46.3,65,Pop
Back in Black,AC/DC,"July 25, 1980",26.1,50,Rock
The Dark Side of the Moon,Pink Floyd,"March 1, 1973",24.2,45,Rock
;;;;

proc print;
run;&lt;/PRE&gt;
&lt;PRE&gt;                                                                       Total
                                                          Release    Certified    Claimed
Obs    Album                        Artist                   Date      Copies      Sales     Genre

 1     Thriller                     Michael Jackson    1982-11-30       46.3         65      Pop
 2     Back in Black                AC/DC              1980-07-25       26.1         50      Rock
 3     The Dark Side of the Moon    Pink Floyd         1973-03-01       24.2         45      Rock

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 04 Mar 2018 21:23:16 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2018-03-04T21:23:16Z</dc:date>
    <item>
      <title>Reading DATE data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-DATE-data/m-p/442156#M110592</link>
      <description>&lt;P&gt;I am trying to read data that is originally read as WORDDATE, and I want to display it as MMDDYY. I have used many different informats like: DATEw, MMDDYY10., ABYDTDTE10. But instead, all I get are *******,&amp;nbsp; WORDDATE type or a numeric count of days since day 0.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here it is my code and I have attached the data set to this question:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC IMPORT DATAFILE="/folders/myfolders/TopGrossingAlbumsR.txt"&lt;BR /&gt;     OUT=music&lt;BR /&gt;     DBMS=csv&lt;BR /&gt;     REPLACE;&lt;BR /&gt;     firstobs = 2;&lt;BR /&gt;     INPUT Album :$50. Artist :$50. ReleaseDate :DATETIME. TotalCertifiedCopies : ClaimedSales : Genre $ ;&lt;BR /&gt;     &lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;PROC PRINT DATA = music; &lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;PROC PRINT DATA = music; &lt;BR /&gt;	INFORMAT ReleaseDate MMDDYY10. ;&lt;BR /&gt;RUN; &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Mar 2018 17:55:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-DATE-data/m-p/442156#M110592</guid>
      <dc:creator>Miah</dc:creator>
      <dc:date>2018-03-04T17:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: Reading DATE data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-DATE-data/m-p/442158#M110594</link>
      <description>&lt;P&gt;To extract the date from a datetime value, use the datepart() function.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Mar 2018 18:57:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-DATE-data/m-p/442158#M110594</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-04T18:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: Reading DATE data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-DATE-data/m-p/442159#M110595</link>
      <description>&lt;P&gt;You're mixing input methods here. Either you use PROC IMPORT or you use an INPUT statement within a data step but not both.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC IMPORT will guess at types and you can set GUESSINGROWS=MAX to get the best attempt.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC IMPORT DATAFILE="/folders/myfolders/TopGrossingAlbumsR.txt"
     OUT=music
     DBMS=csv
     REPLACE;

     getnames= yes;
     guessingrows=max;     
RUN;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you can try and INPUT statement within a data step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data music_data_step;
infile '/folders/myfolders/TopGrossingAlbumsR.txt' dsd firstobs=2;
length album $50 artist $50 genre $20.;
informat releaseDate anydtdte.;
format releaseDate date9.;

input album artist releaseDate totalCertifiedCopies ClaimedSales Genre;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 04 Mar 2018 18:57:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-DATE-data/m-p/442159#M110595</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-04T18:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Reading DATE data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-DATE-data/m-p/442182#M110601</link>
      <description>&lt;P&gt;You seem confused between what an INFORMAT does and what a FORMAT does. An INFORMAT is instructions for how to convert text into the value that is stored. A FORMAT is instructions for how to convert the value that is stored into text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a date variable and you want to print the value in MDY order then use the MMDDYY format.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC PRINT DATA = music; 
  FORMAT ReleaseDate MMDDYY10. ;
RUN; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Of course if you want your friends in the UK to understand it then it might be better to use the YYMMDD format instead as nobody will confuse the value 2018-12-10 as meaning the twelfth of November instead of the tenth of December.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you try using the ANYDTDTE. informat to read your existing CSV file?&lt;/P&gt;
&lt;PRE&gt;data test;
  infile cards dsd truncover firstobs=2 ;
  input Album :$50. Artist :$50. ReleaseDate :ANYDTDTE.
       TotalCertifiedCopies ClaimedSales Genre :$50.
  ;
  format ReleaseDate yymmdd10.;
cards4;
Album,Artist,ReleaseDate,TotalCertifiedCopies,ClaimedSales,Genre
Thriller,Michael Jackson,"November 30, 1982",46.3,65,Pop
Back in Black,AC/DC,"July 25, 1980",26.1,50,Rock
The Dark Side of the Moon,Pink Floyd,"March 1, 1973",24.2,45,Rock
;;;;

proc print;
run;&lt;/PRE&gt;
&lt;PRE&gt;                                                                       Total
                                                          Release    Certified    Claimed
Obs    Album                        Artist                   Date      Copies      Sales     Genre

 1     Thriller                     Michael Jackson    1982-11-30       46.3         65      Pop
 2     Back in Black                AC/DC              1980-07-25       26.1         50      Rock
 3     The Dark Side of the Moon    Pink Floyd         1973-03-01       24.2         45      Rock

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Mar 2018 21:23:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-DATE-data/m-p/442182#M110601</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-03-04T21:23:16Z</dc:date>
    </item>
  </channel>
</rss>

