<?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 stop converting date from UK to US format while reading from excel in Administration and Deployment</title>
    <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952746#M29368</link>
    <description>&lt;P&gt;In case this issue is occurring only in the production environment, please work with your SAS Administrator and investigate the cause. Do look into the program and server logs.&lt;BR /&gt;If possible, enable the workspace server log to capture the logs for this program.&lt;/P&gt;</description>
    <pubDate>Fri, 06 Dec 2024 13:51:22 GMT</pubDate>
    <dc:creator>Sajid01</dc:creator>
    <dc:date>2024-12-06T13:51:22Z</dc:date>
    <item>
      <title>How to stop converting date from UK to US format while reading from excel</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952673#M29359</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Recently we are hitting a problem in date format when we read data from external file using proc import and we are finally exporting into a csv file. The dates are exporting into csv as US format ( not UK ).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Eg: The excel_date in excel_test.xlxs file is 12/01/2024 ( dd/mm/yyyy )&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc import;&lt;/P&gt;
&lt;P&gt;out=test_import ( keep = excel_date )&lt;/P&gt;
&lt;P&gt;Datafile= excel_test.xlxs&lt;/P&gt;
&lt;P&gt;dbms=xlsx;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test1;&lt;/P&gt;
&lt;P&gt;format new_date date9,;&lt;/P&gt;
&lt;P&gt;set test_import;&lt;/P&gt;
&lt;P&gt;new_date = excel_date;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc export data = test1&lt;/P&gt;
&lt;P&gt;outfile="new_date.csv"&lt;/P&gt;
&lt;P&gt;dbms=csv;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;When we run the code, output of sas dataset (test1) as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;new_date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;excel_date&amp;nbsp;&lt;/P&gt;
&lt;P&gt;12JAN2024&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01/12/2024 ( getting changed here)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While exporting into csv ( new_date.csv ) from test1 sasdataset&amp;nbsp; ,&lt;/P&gt;
&lt;P&gt;new_date is exported as 12JAN2024 and excel_date as 01/12/2024 which matches the dataset value. But the actual value for excel_date value in the excel as 12/01/2024 but the value gets changed in csv for that column.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the value of date in excel is 27/01/2024 , then the csv export dont have any problem as it export the value correctly to csv. I suspect the problem is when the value in the excel file has date value less than&amp;nbsp; or equal 12. If the date is greater than 12 , sas not able to convert as we dont have month greater than 12.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was running below query to check anything got changed, but no luck&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc options option=(DATESTYLE LOCALE) value;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Option Value information for SAS Option Datastyle&lt;/P&gt;
&lt;P&gt;Value : MDY&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Option Value information for SAS Option Locale&lt;/P&gt;
&lt;P&gt;Value: EN_GB&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Only recently we are getting this problem, until last month there were no issue.&amp;nbsp; Even in linux OS where SAS is installed ,we do have locale setting as en_GB.&lt;/P&gt;
&lt;P&gt;It seems the excel date values are stored in sas dataset&amp;nbsp; as US format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let me know if there is a fix to resolve the issue. We cant change sas code as there are lot of sas code has date values and as I said , this code was working for years.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2024 21:53:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952673#M29359</guid>
      <dc:creator>freshstarter</dc:creator>
      <dc:date>2024-12-05T21:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop converting date from UK to US format while reading from excel</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952682#M29360</link>
      <description>&lt;P&gt;Look at the raw number stored in the Excel file. Format the cell as a simple number, and show us what you get.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2024 23:06:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952682#M29360</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-12-05T23:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop converting date from UK to US format while reading from excel</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952683#M29361</link>
      <description>&lt;P&gt;A CSV file has no "format", only strings.&amp;nbsp; Are you saying the date strings in the CSV file are in MDY order and not DMY order?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you use GUESSINGROWS=MAX and there is at least one observation that has a day of the month larger then 12 then PROC IMPORT should pick the right INFORMAT for the column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if all of the day of month values are 12 or less then there is NO WAY for PROC IMPORT to KNOW what was intended by the strings in the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But why are you using PROC IMPORT to read CSV files?&amp;nbsp; Since you seem to know what is in them just write the data step to read them yourself.&amp;nbsp; Then you can decide what informat to use.&amp;nbsp; In general I find it is always better and frequently easier to write the data step myself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that the DATESTYLE option effects the decisions made by the ANY... series of informats.&amp;nbsp; But PROC IMPORT will only use that informat if the text values it sees in the column are inconsistent.&amp;nbsp; If they all look like MDY date strings it will use the MMDDYY informat.&amp;nbsp; If the all look like DMY date strings it will use the DDMMYY informat.&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>Thu, 05 Dec 2024 23:51:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952683#M29361</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-12-05T23:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop converting date from UK to US format while reading from excel</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952691#M29362</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462296"&gt;@freshstarter&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;From what that has been posted it is difficult to ppin point the cause.&lt;BR /&gt;However, a small change in the format statement &lt;STRONG&gt;"&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;format new_date date9,"&lt;/STRONG&gt; to "&amp;nbsp;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&lt;STRONG&gt;"format new_date ddmmyys10.;"&lt;/STRONG&gt; &lt;/FONT&gt;&amp;nbsp; should solve your problem.&lt;BR /&gt;This can be verified from the code below.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;option locale="EN_GB";
data test;
format dt1 ddmmyys10.;
dt1="12JAN2024"d.;
run;
proc export data=test outfile="/full_path/test.csv";
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;The csv file had the correct format "12/01/2024" irrespective of where you open it (notepad or Excel).&lt;BR /&gt;I have verified with both 12th Jan and 31st Jan. It works as expected.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 01:09:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952691#M29362</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2024-12-06T01:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop converting date from UK to US format while reading from excel</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952708#M29363</link>
      <description>Hello all,&lt;BR /&gt;&lt;BR /&gt;I want to let you know that there are two environments we do have .. Prod and Dev.. only in prod environment, we are facing this issue not in Dev.. I will answer for your queries  soon</description>
      <pubDate>Fri, 06 Dec 2024 06:37:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952708#M29363</guid>
      <dc:creator>freshstarter</dc:creator>
      <dc:date>2024-12-06T06:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop converting date from UK to US format while reading from excel</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952716#M29365</link>
      <description>&lt;P&gt;It sounds like there has been a recent change to your Prod environment.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you already tried what happens if you set at the beginning of your job below two options.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options datestyle=dmy locale=en_gb;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Dec 2024 10:39:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952716#M29365</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-12-06T10:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop converting date from UK to US format while reading from excel</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952742#M29367</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462296"&gt;@freshstarter&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hello all,&lt;BR /&gt;&lt;BR /&gt;I want to let you know that there are two environments we do have .. Prod and Dev.. only in prod environment, we are facing this issue not in Dev.. I will answer for your queries soon&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What is different between the two environments?&amp;nbsp; Are they using different computer systems? Different SAS installations?&amp;nbsp; Different versions of SAS?&amp;nbsp; Different user running the program?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the key difference is probably that they are reading different CSV files.&amp;nbsp; PROC IMPORT has to GUESS how to define the dataset based on just the information in the single file it is looking at.&amp;nbsp; Give it a slightly different input file and you can get different variable names, variable types, variable storage lengths, different informats used, different formats attached.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 13:33:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952742#M29367</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-12-06T13:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop converting date from UK to US format while reading from excel</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952746#M29368</link>
      <description>&lt;P&gt;In case this issue is occurring only in the production environment, please work with your SAS Administrator and investigate the cause. Do look into the program and server logs.&lt;BR /&gt;If possible, enable the workspace server log to capture the logs for this program.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 13:51:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952746#M29368</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2024-12-06T13:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop converting date from UK to US format while reading from excel</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952759#M29369</link>
      <description>I might be missing something here, but I think the problem is that you are forcing the format date9. in your data processing. Long story short, export and import are fine. Your data step has the wrong format. Change it, problem solved!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And, indeed, in the SAS datasets, there is no formatting, just a numeric value. Formats are used to read and write those values. In short, in short, just a representation of a natural number.&lt;BR /&gt;&lt;BR /&gt;Please give a look to the documentation:&lt;BR /&gt;&lt;A href="https://documentation.sas.com/doc/en/vdmmlcdc/8.1/ds2pg/p0bz5detpfj01qn1kz2in7xymkdl.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/vdmmlcdc/8.1/ds2pg/p0bz5detpfj01qn1kz2in7xymkdl.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;"...The following table displays the results of formatting the date March 17, 2012..."&lt;BR /&gt;&lt;BR /&gt;DATE9. :19069 —&amp;gt; 17MAR2012&lt;BR /&gt;&lt;BR /&gt;In short, if you use date9. the value 19069 in the dataset will be formated as 17MAR2012, which is what you are experiencing and not desired.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;When you want to keep the format 01/12/2024, you need to use mmddyy10. I think this was indicated earlier.&lt;BR /&gt;&lt;BR /&gt;MMDDYY10. : 19069 —&amp;gt; 03/17/2012&lt;BR /&gt;&lt;BR /&gt;This should resolve any issue, regardless of any undesired difference between the Dev and Prod environments.&lt;BR /&gt;&lt;BR /&gt;I suggest to work on the solution you can be in control of (your code), and raise the fact the 2 environments are different to your administrators, without you needing to wait for them.</description>
      <pubDate>Sat, 07 Dec 2024 04:13:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952759#M29369</guid>
      <dc:creator>JuanS_OCS</dc:creator>
      <dc:date>2024-12-07T04:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop converting date from UK to US format while reading from excel</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952775#M29370</link>
      <description>&lt;P&gt;So if you started with an XSLX file note that the LOCALE used in EXCEL can change how EXCEL displays the exact same values when formatted as "date".&lt;/P&gt;
&lt;P&gt;In this XLSX file I typed the same 12/31/2024 string into the cells A2 to A4.&amp;nbsp; I then use the menus to leave the formatting as DATE but change the LOCALE used for each of them.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_1-1733513300778.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102747i822198E5EB993197/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_1-1733513300778.png" alt="Tom_1-1733513300778.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I use&amp;nbsp;PROC IMPORT to make a SAS dataset the result is a variable with the MMDDYY10. format attached to it.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_2-1733514034800.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102748i1153B00211F6DE71/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_2-1733514034800.png" alt="Tom_2-1733514034800.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;If I ask SAS to read each line separately&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import dbms=xlsx replace
  file='c:\downloads\date_regions.xlsx'
  out=us 
;
  range='$A2:C2';
  getnames=no;
run;

proc print;
  title "US line";
run;
proc import dbms=xlsx replace
  file='c:\downloads\date_regions.xlsx'
  out=uk 
;
  range='$A3:C3';
  getnames=no;
run;

proc print;
  title "UK line";
run;
proc import dbms=xlsx replace
  file='c:\downloads\date_regions.xlsx'
  out=estonian 
;
  range='$A4:C4';
  getnames=no;
run;

proc print;
  title "Estonian line";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;then I get formats attached the match the display used by the XLSX file.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_3-1733514657235.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102749i6D318C6C341102E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_3-1733514657235.png" alt="Tom_3-1733514657235.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But in addition to the LOCALE setting that I modified on those individual files I suspect that the XLSX and/or the EXCEL version you are running might have their own settings for LOCALE.&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>Fri, 06 Dec 2024 19:52:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952775#M29370</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-12-06T19:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop converting date from UK to US format while reading from excel</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952830#M29371</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First thank you for all your suggestions.&amp;nbsp; While digging more into the environments, I have found different sort of issue and the date output issues are same across the mulitple environments. Initially I have considered wrong examples and thats the reason I have mentioned the output are different across enviroment. Sorry for that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now we have come acrosss that datestyle output is different format in proc options;run; from workspace server and we have changed it 'DMY' and tried running the query. It has fixed the issue while reading the data from .csv file ( infile statement ) but not from excel&amp;nbsp; ( using proc import ).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Eg: Reading from excel&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; ----------------------&lt;/P&gt;
&lt;P&gt;proc import&lt;/P&gt;
&lt;P&gt;out = input_files ( keep = start_Date )&lt;/P&gt;
&lt;P&gt;Datafile = "xxxx/input_excelfile.xlxs"&lt;/P&gt;
&lt;P&gt;dbms=xlxs Replace;&lt;/P&gt;
&lt;P&gt;getnames=yes;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data temp;&lt;/P&gt;
&lt;P&gt;set input_files;&lt;/P&gt;
&lt;P&gt;format newdate date9;&lt;/P&gt;
&lt;P&gt;newdate=start_Date;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;THe date available in excel as 02/08/2023 and If I run the above code , I'm getting as below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;start_date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; newdate&lt;/P&gt;
&lt;P&gt;08/02/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 02AUG2023&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Datestyle setting in workspace server is DMY and the locale setting in SAS config / Linux OS and excel sheet are in United Kingdom. I dont know why the conversion is happening while performing the proc import which is causing a problem. Please suggest me with your ideas.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks once again&amp;nbsp; for all your comments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2024 10:34:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952830#M29371</guid>
      <dc:creator>freshstarter</dc:creator>
      <dc:date>2024-12-07T10:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop converting date from UK to US format while reading from excel</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952831#M29372</link>
      <description>I tried , it didnot work &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;</description>
      <pubDate>Sat, 07 Dec 2024 10:36:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952831#M29372</guid>
      <dc:creator>freshstarter</dc:creator>
      <dc:date>2024-12-07T10:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop converting date from UK to US format while reading from excel</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952832#M29373</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462296"&gt;@freshstarter&lt;/a&gt;&amp;nbsp;In your Excel are these cells with date defined as character or date or something else.&lt;/P&gt;
&lt;P&gt;What would help:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a test Excel with just a date column and a few dates that creates this issue in your environment&lt;/LI&gt;
&lt;LI&gt;Share with us this Excel here as an attachment and tell us what the issue is you observe and what the expected result should be
&lt;OL&gt;
&lt;LI&gt;Please share with us the exact Excel you've used for your testing&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Such an Excel would allow us to do some testing to see if we can replicate the issue you describe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2024 11:23:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952832#M29373</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-12-07T11:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop converting date from UK to US format while reading from excel</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952833#M29374</link>
      <description>&lt;P&gt;Attached here the input file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The date in the excel file is 02/08/2023 ( which is 02nd Aug 2023 ) . Our final result expected to be the same in another csv file. This is how our workflow created&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Proc import from xlsx file&lt;/P&gt;
&lt;P&gt;2. Do sas processing&lt;/P&gt;
&lt;P&gt;3. then finally Proc export to csv file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While exporting to csv file, the dates are loaded as 08/02/2023 which is wrong.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another strange behvaiour , I have noticed now is that as per below workflow&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Proc import from xlsx file&lt;/P&gt;
&lt;P&gt;2. Do sas processing&lt;/P&gt;
&lt;P&gt;3. then finally Proc export to another xlsx file ( not csv ).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the same excel sheet , the dates are imported into sas dataset as 08/02/2023 but while exporting the dataset into another new xlxs file, its exported as 02/08/2023 ( 02nd Aug ) which is correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I think the problem arises, when we importing and exporting to different formats ( i.e. xl to csv )&amp;nbsp; which is very strange. This change in behaviour has happended very recently.&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2024 11:41:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952833#M29374</guid>
      <dc:creator>freshstarter</dc:creator>
      <dc:date>2024-12-07T11:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop converting date from UK to US format while reading from excel</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952849#M29375</link>
      <description>&lt;P&gt;If you want the DATE variables to use the DDMMYY format then tell SAS that.&lt;/P&gt;
&lt;P&gt;If you KNOW the names of the variables just add a FORMAT statement at some point in your process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have no idea what date variables you will get then (does not sound like a repeatable process) then first ask SAS to make a list of the names of the DATE variables into a macro variable and use that to write the FORMAT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's say you imported the XSLX sheet into a dataset named WORK.TEST using something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import dbms=xlsx out=test replace
  file="C:\downloads\input_excelfile.xlsx"
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can then do something like this to change the format attached to ALL of the date variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=test noprint out=contents;
run;

proc sql noprint;
  select nliteral(name) into :datevars separated by ' '
  from contents 
  where fmtinfo(format,'cat')='date'
  ;
quit;

proc datasets lib=WORK nolist;
  modify test;
    format &amp;amp;datevars ddmmyy10.;
  run;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1733589671066.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102781i7421A737316EED7B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1733589671066.png" alt="Tom_0-1733589671066.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As to what changed I suspect that somehow your default location has changed from a country like the United Kingdom that prefers DMY order to a country like the United States that prefers MDY order and either SAS or EXCEL is honoring those changed settings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To avoid this issue in the future I suggest that switch to use YMD order for you DATE values.&amp;nbsp; That will not get confused.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2024 16:45:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952849#M29375</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-12-07T16:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop converting date from UK to US format while reading from excel</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952851#M29376</link>
      <description>&lt;P&gt;What DATE is that file supposed to have in it?&lt;/P&gt;
&lt;P&gt;It looks like Independence Day to me.&amp;nbsp; (July 4th).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1733590534878.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102782i1222C00C2DFE5A0F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1733590534878.png" alt="Tom_0-1733590534878.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is your issue that SAS is displaying it as July Fourth (07/04/2023) and you want it displayed as the Fourth of July (04/07/2023).&amp;nbsp; &amp;nbsp;If so then just change the FORMAT attached to the variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if you meant for the file to have the Seventh of April instead of July Fourth then your problem is in the process that is making the XLSX file.&amp;nbsp; My earlier post showed SAS pulls over the actual DATE that Excel has stored, no matter what style Excel is using to display it in the worksheet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2024 18:13:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952851#M29376</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-12-07T18:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop converting date from UK to US format while reading from excel</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952857#M29377</link>
      <description>&lt;P&gt;Shoulf that be July 4th or April 7th?&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2024 18:37:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952857#M29377</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-12-07T18:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop converting date from UK to US format while reading from excel</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952869#M29378</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462296"&gt;@freshstarter&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Attached here the input file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The date in the excel file is 02/08/2023 ( which is 02nd Aug 2023 ) . Our final result expected to be the same in another csv file. This is how our workflow created&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462296"&gt;@freshstarter&lt;/a&gt;&amp;nbsp; The date in the Excel you attached is 4th of July and not as you write&amp;nbsp;02/08/2023&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1733618108702.png" style="width: 272px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102788iCBDD3E45A8C5C94B/image-dimensions/272x92?v=v2" width="272" height="92" role="button" title="Patrick_0-1733618108702.png" alt="Patrick_0-1733618108702.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Import will use the Excel cell Format Code to convert the cell value into a SAS date.&lt;/P&gt;
&lt;P&gt;SAS stores dates in a numerical variable as the count of days since 01Jan1960. SAS date formats make such counts human readable as date strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Contents will tell you what format Proc Import attached to the variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Export will use this format to write strings to a .csv (which is just a text file). For example if the format is date9. then the SAS count of days since 01Jan1960 will get written as a date string of the form ddmonyyyy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've attached an Excel to demonstrate what I'm talking about.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_1-1733618946040.png" style="width: 580px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102789iD7C52F6F0FF47A8B/image-dimensions/580x71?v=v2" width="580" height="71" role="button" title="Patrick_1-1733618946040.png" alt="Patrick_1-1733618946040.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even though the start dates in the two data rows look the same they will create different SAS date values when imported into SAS. The reason is that they've got different cell formats (format code).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can see for yourself if running below code using the attached Excel.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let root_path=/home/&amp;amp;sysuserid;

PROC IMPORT DATAFILE="&amp;amp;root_path/temp/input_excelfile_gb_us.xlsx"
	DBMS=XLSX
	OUT=WORK.excel_gb_us
	replace;
	GETNAMES=YES;
RUN;

proc sql;
	select 
		 format_cells_language
		,format_cells_category
		,format_cells_format
		,format_cells_formatCode
		,start_date format=best32.   label='start_date format=best32.'
		,start_date format=date9.    label='start_date format=date9'
		,start_date format=ddmmyy10. label='start_date format=ddmmyy10.'
		,start_date format=mmddyy10. label='start_date format=mmddyy10.'
	from WORK.excel_gb_us
	;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_2-1733619176632.png" style="width: 910px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102790iB19755E6E3FC75FA/image-dimensions/910x55?v=v2" width="910" height="55" role="button" title="Patrick_2-1733619176632.png" alt="Patrick_2-1733619176632.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The highlighted column above is showing how SAS actually stores the date values (just count of days since 1/1/1960 as a number). The other columns then show how SAS prints these numbers using some of the available date formats. And it's the same when writing to a .csv. It's just the format that "decides" how the values will get written.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And last but not least:&lt;/P&gt;
&lt;P&gt;Similar to SAS also Excel stores dates as the count of days since a start date. With Excel day one is 01Jan1900. The Excel cell format then "decides" how the date displays in the spreadsheet. SAS needs only to know that the cell value is a date and then it's a simple formula to convert the Excel day count to the SAS day count (...with some minor challenge for 1900 where Microsoft wrongly assumed it's a leap year).&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;
&lt;P&gt;&amp;nbsp;&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>Sun, 08 Dec 2024 01:15:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/How-to-stop-converting-date-from-UK-to-US-format-while-reading/m-p/952869#M29378</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-12-08T01:15:15Z</dc:date>
    </item>
  </channel>
</rss>

