<?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: Text to colomn the date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Text-to-colomn-the-date/m-p/631339#M187050</link>
    <description>Thank you Mr.KURT BREMSER&lt;BR /&gt;Can you please suggest me in format for data like&lt;BR /&gt;Mm/dd/yyyy&lt;BR /&gt;03/11/2020&lt;BR /&gt;03/12/2020&lt;BR /&gt;03/13/2020</description>
    <pubDate>Wed, 11 Mar 2020 18:29:20 GMT</pubDate>
    <dc:creator>Rajeshganta</dc:creator>
    <dc:date>2020-03-11T18:29:20Z</dc:date>
    <item>
      <title>Text to colomn the date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-to-colomn-the-date/m-p/627480#M185260</link>
      <description>I have a data from external source as dd-mm-yyyy when i delimit in excel it gets converted to mm/dd/yyyy which is syatem date format how can i use this step in sas</description>
      <pubDate>Wed, 26 Feb 2020 14:00:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-to-colomn-the-date/m-p/627480#M185260</guid>
      <dc:creator>Rajeshganta</dc:creator>
      <dc:date>2020-02-26T14:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Text to colomn the date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-to-colomn-the-date/m-p/627488#M185262</link>
      <description>&lt;P&gt;What is the format of the external data? Do you pull directly from a database, or read from a text file?&lt;/P&gt;
&lt;P&gt;To display a&amp;nbsp;&lt;EM&gt;date value&lt;/EM&gt; (count of days) in the way you want, use the ddmmyyd10. format.&lt;/P&gt;
&lt;P&gt;How date values are displayed in Excel is mostly influenced by Excel settings, not by SAS.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 14:10:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-to-colomn-the-date/m-p/627488#M185262</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-02-26T14:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Text to colomn the date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-to-colomn-the-date/m-p/627489#M185263</link>
      <description>&lt;P&gt;You need to provide more details about what the issue is.&lt;/P&gt;
&lt;P&gt;If you are using SAS to read from a text file then make sure to use the appropriate INFORMAT to convert the text into dates. You can then attach any date type format to the variable to control how the dates are displayed in SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have an Excel file with dates and use SAS to convert that into a SAS dataset it should recognize them as dates.&amp;nbsp; Just make sure that ALL of the cells in the column of the spreadsheet are dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have question on how to get Excel to read the text file properly then this might not be the right forum.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 14:12:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-to-colomn-the-date/m-p/627489#M185263</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-26T14:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: Text to colomn the date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-to-colomn-the-date/m-p/627713#M185356</link>
      <description>Data is pulled from database and the date format i m getting is in character which is like&lt;BR /&gt;27-02-2020&lt;BR /&gt;28-02-2020&lt;BR /&gt;29-02-2020&lt;BR /&gt;But the date is not recognised by sas as per requirement i have to get the data of yesterday with formula of today()-1 so please help me</description>
      <pubDate>Thu, 27 Feb 2020 00:50:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-to-colomn-the-date/m-p/627713#M185356</guid>
      <dc:creator>Rajeshganta</dc:creator>
      <dc:date>2020-02-27T00:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: Text to colomn the date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-to-colomn-the-date/m-p/627770#M185386</link>
      <description>&lt;P&gt;Please show the SAS code you use to import the data. Use the "little running man" icon to post this code.&lt;/P&gt;
&lt;P&gt;To convert character values to dates, do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input mydate $10.;
datalines;
27-02-2020
28-02-2020
29-02-2020
;

data want;
set have (rename=(mydate=_mydate));
mydate = input(_mydate,ddmmyy10.);
format mydate e8601da10.;
drop _mydate;
run;

proc print data=want noobs;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;mydate

2020-02-27
2020-02-28
2020-02-29
&lt;/PRE&gt;
&lt;P&gt;It should be possible to incorporate the conversion in your import step.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 06:18:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-to-colomn-the-date/m-p/627770#M185386</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-02-27T06:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: Text to colomn the date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-to-colomn-the-date/m-p/627788#M185397</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/311722"&gt;@Rajeshganta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Data is pulled from database and the date format i m getting is in character which is like&lt;BR /&gt;27-02-2020&lt;BR /&gt;28-02-2020&lt;BR /&gt;29-02-2020&lt;BR /&gt;But the date is not recognised by sas as per requirement i have to get the data of yesterday with formula of today()-1 so please help me&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If the column in the database is of type DATE (or similar) then SAS gets things normally right and creates a SAS Date value stored in a SAS numerical variable. So... are you sure that the variable on the SAS side is of type character? Or is it a numerical variable and just has a date format applied other than what you'd like it to be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below code should give you the pointers for both how to change the format or how to convert a string to a SAS date value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines truncover;
input 
  @1 date_as_string $10.
  @1 date_as_SASDateValue ddmmyy10.;

  /* 
     date_as_SASDateValue contains the count of days since 1/1/1960
     applying SAS formats on such values prints the date human readable (does NOT change the value).
     docu here:
     https://go.documentation.sas.com/?docsetId=leforinforref&amp;amp;docsetTarget=n0p2fmevfgj470n17h4k9f27qjag.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en
  */
  format SASDateFormatted_1 ddmmyyD10.;
  SASDateFormatted_1=date_as_SASDateValue;

  format SASDateFormatted_2 ddmmyy10.;
  SASDateFormatted_2=date_as_SASDateValue;

  /* here how to convert a string representing a date to a SAS date value */
  format SASDateFormatted_3 date9.;
  SASDateFormatted_3 = input(date_as_string,ddmmyy10.);

  /* because SAS date values are simply a count of days one can use this
     data for calculations. Here how to substract a day
  */
  format SASDateFormatted_4 b8601da.;
  SASDateFormatted_4 = date_as_SASDateValue -1;

datalines;
27-02-2020
28-02-2020
29-02-2020
;

proc print data=have;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When writing a SAS table to a database (or Excel) then I've made the experience that things work best if you apply a format of DATE9 to variable with SAS date values and a format of DATETIME20 to variables with SAS datetime values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 07:08:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-to-colomn-the-date/m-p/627788#M185397</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-02-27T07:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Text to colomn the date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-to-colomn-the-date/m-p/631339#M187050</link>
      <description>Thank you Mr.KURT BREMSER&lt;BR /&gt;Can you please suggest me in format for data like&lt;BR /&gt;Mm/dd/yyyy&lt;BR /&gt;03/11/2020&lt;BR /&gt;03/12/2020&lt;BR /&gt;03/13/2020</description>
      <pubDate>Wed, 11 Mar 2020 18:29:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-to-colomn-the-date/m-p/631339#M187050</guid>
      <dc:creator>Rajeshganta</dc:creator>
      <dc:date>2020-03-11T18:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: Text to colomn the date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-to-colomn-the-date/m-p/631347#M187057</link>
      <description>&lt;P&gt;Maxim 1: Read the Documentation.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=leforinforref&amp;amp;docsetTarget=n0verk17pchh4vn1akrrv0b5w3r0.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=leforinforref&amp;amp;docsetTarget=n0verk17pchh4vn1akrrv0b5w3r0.htm&amp;amp;locale=en&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look under Date and Time for the fitting informat.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2020 18:59:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-to-colomn-the-date/m-p/631347#M187057</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-11T18:59:26Z</dc:date>
    </item>
  </channel>
</rss>

