<?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: Convert text of long date to short date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-text-of-long-date-to-short-date/m-p/844687#M333938</link>
    <description>&lt;P&gt;Please post data as text so we don't have to make it up.&amp;nbsp; Your picture has invalid dates (those dates are all on Friday).&amp;nbsp; But that is not the problem.&amp;nbsp; The ANYDTDTE informat does not know what to do with strings in that format.&lt;/P&gt;
&lt;P&gt;You can just remove the day of the week.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input date date9. ;
  string1=catx(', ',put(date,downame.),put(date,worddate.));
  string2=substr(string1,index(string1,',')+1);
  date1=input(string1,anydtdte60.);
  date2=input(string2,anydtdte60.);
  format date: date9.;
cards;
13OCT2017
20OCT2017
06OCT2017
;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs         date            string1                 string2             date1        date2

 1     13OCT2017    Friday, October 13, 2017    October 13, 2017            .    13OCT2017
 2     20OCT2017    Friday, October 20, 2017    October 20, 2017            .    20OCT2017
 3     06OCT2017    Friday, October 6, 2017     October 6, 2017             .    06OCT2017



&lt;/PRE&gt;</description>
    <pubDate>Wed, 16 Nov 2022 19:04:26 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-11-16T19:04:26Z</dc:date>
    <item>
      <title>Convert text of long date to short date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-text-of-long-date-to-short-date/m-p/844236#M333765</link>
      <description>&lt;P&gt;&lt;FONT color="#0000FF"&gt;Importing some Excel data with a column of dates in Saturday, October 31, 2018 format.&amp;nbsp; Need to convert them to Oct312018.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;data import;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;format Appt_date $30.;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /*CLEARLY DEFINING appt_date AS A CHARACTER.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;set xport;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;data full_date;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;FORMAT Appt_dt MMDDYYS10.;&amp;nbsp; &amp;nbsp;/* CREATING AN ADDITIONAL VARIABLE IN MMDDYYS10. FORMAT.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Appt_Dt=INPUT(Appt_date, ANYDTDTE10.);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;set import;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LOG:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt; data full_date;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;26 FORMAT Appt_dt MMDDYYS10.;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;27 Appt_Dt=INPUT(Appt_date, ANYDTDTE10.);&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;28 set import;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;ERROR: Variable Appt_date has been defined as both character and numeric.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Appt_Date has clearly NOT been defined as both character and numeric.&amp;nbsp; I don't know what gives, but I have to convert long text dates to a more standard SAS format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 23:24:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-text-of-long-date-to-short-date/m-p/844236#M333765</guid>
      <dc:creator>Jumboshrimps</dc:creator>
      <dc:date>2022-11-14T23:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: Convert text of long date to short date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-text-of-long-date-to-short-date/m-p/844258#M333774</link>
      <description>&lt;P&gt;What does the log of the IMPORT DATA step look like?&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
      30:13 &lt;/PRE&gt;
&lt;P&gt;If it contains anything like the above your excel data never started out as character anyway and applying a FORMAT statement won't convert it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run this to confirm what the variable type for&amp;nbsp;Appt_date is to start with:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data = import;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Nov 2022 03:20:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-text-of-long-date-to-short-date/m-p/844258#M333774</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-11-15T03:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Convert text of long date to short date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-text-of-long-date-to-short-date/m-p/844267#M333777</link>
      <description>&lt;P&gt;Your statements are out of order.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So you said.&amp;nbsp; Convert APPT_DATE to APPT_DT.&amp;nbsp; Now read the value of APPT_DATE from IMPORT.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Since you never gave SAS any hint (or at least any hint that it used) how to define APPT_DATE it defined it as NUMERIC.&amp;nbsp; Then when it looked it the IMPORT dataset you referenced in the SET statement it found out you had a conflict of definition.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Let's look at the data step code line by line.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data full_date;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;So first you tell SAS to start an new data step that will create the dataset FULL_DATE.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FORMAT Appt_dt MMDDYYS10.;   
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Then you tell SAS that the APPT_DT variable should be displayed using the MMDDYYS10. format.&amp;nbsp; Since you have not previously referenced this variable SAS guesses that you wanted APPT_DT to be a NUMERIC variable since you are asking it to be displayed using a numeric format.&amp;nbsp; Note that the unclosed block comments you added in the code you posted (but fortunately did not include in the code you ran) are going to confuse the people reading the code.&amp;nbsp; A FORMAT statement does not DEFINE a variable any more than any other usage, such as an assignment statement or an array statement, defines a variable.&amp;nbsp; If you want to really be sure how the variable is defined, what its TYPE is and what its storage length is, then use a LENGTH statement (or the ATTRIB statement with the LENGTH= option).&amp;nbsp; The FORMAT statement is for defining how you want the variable DISPLAYED.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Appt_Dt=INPUT(Appt_date, ANYDTDTE10.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Now calculate the value of APPT_DT from the value of APPT_DATE.&amp;nbsp; SInce APPT_DATE has not been defined yet SAS will guess that it should be numeric. (SAS makes stupid guesses sometimes. That is why it is safer to actually define the variables yourself).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also notice that (assuming you had defined APPT_DATE with the right type before this statement) that placing the statement here will mean that APPT_DT is calculated from the PREVIOUS value of APPT_DATE, since the current value has not been read in by the SET statement yet.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if you wanted to generate APPT_DT(length=8) from APPT_DATE (length=$30) then use code like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data full_date;
  set import;
  length appt_dt 8;
  Appt_Dt=INPUT(Appt_date, ANYDTDTE60.);
* Display APPT_DT in mm/dd/yyyy style ;
  FORMAT Appt_dt MMDDYYS10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The INPUT() function does not care if the width used in the informat is larger than the length of the string being read.&amp;nbsp; SInce the maximum width that the ANYDTDTE informat can use is 60 just go ahead and use that.&amp;nbsp; Just incase the next time you IMPORT that dataset SAS guesses that the length should be more than $30.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Comments should appear BEFORE the code they are explaining. It makes it much clearer for the reader.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 04:23:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-text-of-long-date-to-short-date/m-p/844267#M333777</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-11-15T04:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: Convert text of long date to short date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-text-of-long-date-to-short-date/m-p/844678#M333932</link>
      <description>&lt;P&gt;&lt;FONT color="#0000FF"&gt;Thanks for your reply.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;Working on this the last two days with no success.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;Made some dummy long dates (well three).&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;Data set before code:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Jumboshrimps_1-1668621816952.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77367iB707A95A7E41C26B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jumboshrimps_1-1668621816952.png" alt="Jumboshrimps_1-1668621816952.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;After code as below:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;data full_date;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;set import;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;length appt_dt 8;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Appt_Dt=INPUT(Appt_date, ANYDTDTE60.);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;* Display APPT_DT in mm/dd/yyyy style ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;FORMAT Appt_dt MMDDYYS10.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="trebuchet ms,geneva" color="#0000FF"&gt;Resulting data set:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Jumboshrimps_2-1668621868164.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77368i37D883517AF7FA3B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jumboshrimps_2-1668621868164.png" alt="Jumboshrimps_2-1668621868164.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;LOG:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;24 data full_date;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;25 set import;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;26 length appt_dt 8;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;27 Appt_Dt=INPUT(Appt_date, ANYDTDTE60.);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;28 * Display APPT_DT in mm/dd/yyyy style ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;29 FORMAT Appt_dt MMDDYYS10.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;30 run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;NOTE: There were 3 observations read from the data set WORK.IMPORT.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;NOTE: The data set WORK.FULL_DATE has 3 observations and 3 variables.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;NOTE: Compressing data set WORK.FULL_DATE decreased size by 0.00 percent. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;Compressed is 1 pages; un-compressed would require 1 pages.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;NOTE: DATA statement used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;real time 0.00 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;user cpu time 0.00 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;system cpu time 0.00 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;memory 568.40k&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;OS Memory 22948.00k&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;Timestamp 11/16/2022 10:01:07 AM&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;Step Count 113 Switch Count 2&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;Page Faults 0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;Page Reclaims 51&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;Page Swaps 0&lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;I have seen literally page after page on how to convert strings of mmddyy or mmm-dd-yy or mm/dd/yy to a numeric date, but no one wants to tackle strings of dates in Week day format.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 20:08:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-text-of-long-date-to-short-date/m-p/844678#M333932</guid>
      <dc:creator>Jumboshrimps</dc:creator>
      <dc:date>2022-11-16T20:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: Convert text of long date to short date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-text-of-long-date-to-short-date/m-p/844682#M333936</link>
      <description>&lt;P&gt;Strip out the day of the week (like Wednesday), and the rest can be read with the informat anydtdte50.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;                            
    dateinfo='Wednesday, October 13, 2017';   
    where_comma=find(dateinfo,','); 
    sasdate=input(substr(dateinfo,where_comma+2),anydtdte50.);      
    put sasdate ;                            
    put sasdate date9.;                      
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Nov 2022 18:42:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-text-of-long-date-to-short-date/m-p/844682#M333936</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-16T18:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Convert text of long date to short date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-text-of-long-date-to-short-date/m-p/844686#M333937</link>
      <description>&lt;P&gt;Your fake dates are invalid. &lt;BR /&gt;October 13, 2017 is a Friday so the Wednesday isn't correct so SAS &lt;STRIKE&gt;doesn't&amp;nbsp;&lt;/STRIKE&gt;shouldn't convert it. &lt;BR /&gt;&lt;BR /&gt;If you get rid of the day of the week component, then SAS will convert it. If you need to verify that portion as well, you can write some custom code to do that. &lt;BR /&gt;&lt;BR /&gt;data have;&lt;BR /&gt;appt_date = 'Wednesday, November 16, 2022'; output;&lt;BR /&gt;appt_date = 'Tuesday, November 15, 2022'; output;&lt;BR /&gt;appt_date = 'Monday, November 6, 2022'; output;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;Appt_Dt=trim(catx(", ", scan(appt_date, 2, ","), scan(appt_date, 3, ",") ));&lt;BR /&gt;appt_dt2= input(Appt_Dt, anydtdte60.);&lt;BR /&gt;FORMAT Appt_dt2 date9.;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 18:54:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-text-of-long-date-to-short-date/m-p/844686#M333937</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-11-16T18:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Convert text of long date to short date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-text-of-long-date-to-short-date/m-p/844687#M333938</link>
      <description>&lt;P&gt;Please post data as text so we don't have to make it up.&amp;nbsp; Your picture has invalid dates (those dates are all on Friday).&amp;nbsp; But that is not the problem.&amp;nbsp; The ANYDTDTE informat does not know what to do with strings in that format.&lt;/P&gt;
&lt;P&gt;You can just remove the day of the week.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input date date9. ;
  string1=catx(', ',put(date,downame.),put(date,worddate.));
  string2=substr(string1,index(string1,',')+1);
  date1=input(string1,anydtdte60.);
  date2=input(string2,anydtdte60.);
  format date: date9.;
cards;
13OCT2017
20OCT2017
06OCT2017
;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs         date            string1                 string2             date1        date2

 1     13OCT2017    Friday, October 13, 2017    October 13, 2017            .    13OCT2017
 2     20OCT2017    Friday, October 20, 2017    October 20, 2017            .    20OCT2017
 3     06OCT2017    Friday, October 6, 2017     October 6, 2017             .    06OCT2017



&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Nov 2022 19:04:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-text-of-long-date-to-short-date/m-p/844687#M333938</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-11-16T19:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Convert text of long date to short date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-text-of-long-date-to-short-date/m-p/844704#M333944</link>
      <description>&lt;P&gt;Much better!!!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I had to use &lt;STRONG&gt;&lt;U&gt;real&lt;/U&gt;&lt;/STRONG&gt; dates for SAS to convert them?&lt;/P&gt;
&lt;P&gt;Who knew?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanx.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 20:32:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-text-of-long-date-to-short-date/m-p/844704#M333944</guid>
      <dc:creator>Jumboshrimps</dc:creator>
      <dc:date>2022-11-16T20:32:54Z</dc:date>
    </item>
  </channel>
</rss>

