<?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: SAS Changing Dates After Conversion from Character Variable for Only Some Variables in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/SAS-Changing-Dates-After-Conversion-from-Character-Variable-for/m-p/783780#M10309</link>
    <description>&lt;P&gt;Thanks, that worked! I was making an extra step for myself.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Dec 2021 21:03:07 GMT</pubDate>
    <dc:creator>leackell13</dc:creator>
    <dc:date>2021-12-02T21:03:07Z</dc:date>
    <item>
      <title>SAS Changing Dates After Conversion from Character Variable for Only Some Variables</title>
      <link>https://communities.sas.com/t5/SAS-Studio/SAS-Changing-Dates-After-Conversion-from-Character-Variable-for/m-p/783754#M10306</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had previously posted about this issue, and for most of my variables, deleting the cells that weren't dates in the Excel file before importing the file and converting the variables worked:&lt;/P&gt;&lt;PRE&gt;date_varService = Input(Service_Date, mmddyy10.);&lt;BR /&gt;	format date_varService mmddyy10.;&lt;BR /&gt;	DROP Service_Date;&lt;BR /&gt;	RENAME date_varService=Service_Date;&lt;/PRE&gt;&lt;P&gt;However, there are 2 variables where that has not worked, and the other suggestions people have given have not worked. For one of the variables (Immediate_postop_XR_date), the 1st 3 dates are: 8/22/2016, 7/3/2019, and 1/15/2018. When I do the method above, I get 4/26/2004, ., and ., respectively.&lt;/P&gt;&lt;P&gt;21916 and 20454 are the 2 numbers that were suggested to convert Excel's calculation of dates to SAS's calculation of dates, but when I try this code:&lt;/P&gt;&lt;PRE&gt;XR_num = Input(Immediate_postop_XR_date, 8.);&lt;BR /&gt;	XR_right = XR_num - 21916;&lt;BR /&gt;	XR_char = Put(XR_right, $10.);&lt;BR /&gt;	date_varXR = Input(XR_char, mmddyy10.);&lt;BR /&gt;	format date_varXR mmddyy10.;&lt;BR /&gt;	DROP Immediate_postop_XR_date;&lt;BR /&gt;	RENAME date_varXR=Immediate_postop_XR_date;&lt;/PRE&gt;&lt;P&gt;I get 2/6/1988, 2/17/1933, and 2/11/1999.&lt;/P&gt;&lt;P&gt;And when I try this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;XR_num = Input(Immediate_postop_XR_date, 8.);&lt;BR /&gt;	XR_right = XR_num - 20454;&lt;BR /&gt;	XR_char = Put(XR_right, $10.);&lt;BR /&gt;	date_varXR = Input(XR_char, mmddyy10.);&lt;BR /&gt;	format date_varXR mmddyy10.;&lt;BR /&gt;	DROP Immediate_postop_XR_date;&lt;BR /&gt;	RENAME date_varXR=Immediate_postop_XR_date;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I get 2/21/1950, ., and 2/26/1961.&lt;/P&gt;&lt;P&gt;I'm using SAS Studio&amp;nbsp;Release: 3.8 (Enterprise Edition)&lt;/P&gt;&lt;P&gt;Build date: Sep 1, 2020 11:12:26 AM&lt;BR /&gt;SAS release: 9.04.01M6P11072018&lt;BR /&gt;SAS platform: Linux LIN X64 3.10.0-1062.9.1.el7.x86_64&lt;BR /&gt;Site name: SAS ONDEMAND FOR ACADEMICS&lt;BR /&gt;Site number: 70094220&lt;/P&gt;&lt;P&gt;Would that make a difference?&lt;/P&gt;&lt;P&gt;While I don't see any non-dates or spaces in the variables I'm having trouble with, I've attached an Excel file with just those variables so you can see if I've missed anything.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Dec 2021 19:40:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/SAS-Changing-Dates-After-Conversion-from-Character-Variable-for/m-p/783754#M10306</guid>
      <dc:creator>leackell13</dc:creator>
      <dc:date>2021-12-02T19:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Changing Dates After Conversion from Character Variable for Only Some Variables</title>
      <link>https://communities.sas.com/t5/SAS-Studio/SAS-Changing-Dates-After-Conversion-from-Character-Variable-for/m-p/783769#M10308</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;XR_num = Input(Immediate_postop_XR_date, 8.);
date_xr = XR_num - 21916;
format date_varXR mmddyy10.;
	&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you're inputting it as 8. I assume you're seeing something like 21436? If so, something like above is likely what you need instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you show a screenshot of the data in SAS and provide variable types?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/407085"&gt;@leackell13&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I had previously posted about this issue, and for most of my variables, deleting the cells that weren't dates in the Excel file before importing the file and converting the variables worked:&lt;/P&gt;
&lt;PRE&gt;date_varService = Input(Service_Date, mmddyy10.);&lt;BR /&gt;	format date_varService mmddyy10.;&lt;BR /&gt;	DROP Service_Date;&lt;BR /&gt;	RENAME date_varService=Service_Date;&lt;/PRE&gt;
&lt;P&gt;However, there are 2 variables where that has not worked, and the other suggestions people have given have not worked. For one of the variables (Immediate_postop_XR_date), the 1st 3 dates are: 8/22/2016, 7/3/2019, and 1/15/2018. When I do the method above, I get 4/26/2004, ., and ., respectively.&lt;/P&gt;
&lt;P&gt;21916 and 20454 are the 2 numbers that were suggested to convert Excel's calculation of dates to SAS's calculation of dates, but when I try this code:&lt;/P&gt;
&lt;PRE&gt;XR_num = Input(Immediate_postop_XR_date, 8.);&lt;BR /&gt;	XR_right = XR_num - 21916;&lt;BR /&gt;	XR_char = Put(XR_right, $10.);&lt;BR /&gt;	date_varXR = Input(XR_char, mmddyy10.);&lt;BR /&gt;	format date_varXR mmddyy10.;&lt;BR /&gt;	DROP Immediate_postop_XR_date;&lt;BR /&gt;	RENAME date_varXR=Immediate_postop_XR_date;&lt;/PRE&gt;
&lt;P&gt;I get 2/6/1988, 2/17/1933, and 2/11/1999.&lt;/P&gt;
&lt;P&gt;And when I try this code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;XR_num = Input(Immediate_postop_XR_date, 8.);&lt;BR /&gt;	XR_right = XR_num - 20454;&lt;BR /&gt;	XR_char = Put(XR_right, $10.);&lt;BR /&gt;	date_varXR = Input(XR_char, mmddyy10.);&lt;BR /&gt;	format date_varXR mmddyy10.;&lt;BR /&gt;	DROP Immediate_postop_XR_date;&lt;BR /&gt;	RENAME date_varXR=Immediate_postop_XR_date;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;I get 2/21/1950, ., and 2/26/1961.&lt;/P&gt;
&lt;P&gt;I'm using SAS Studio&amp;nbsp;Release: 3.8 (Enterprise Edition)&lt;/P&gt;
&lt;P&gt;Build date: Sep 1, 2020 11:12:26 AM&lt;BR /&gt;SAS release: 9.04.01M6P11072018&lt;BR /&gt;SAS platform: Linux LIN X64 3.10.0-1062.9.1.el7.x86_64&lt;BR /&gt;Site name: SAS ONDEMAND FOR ACADEMICS&lt;BR /&gt;Site number: 70094220&lt;/P&gt;
&lt;P&gt;Would that make a difference?&lt;/P&gt;
&lt;P&gt;While I don't see any non-dates or spaces in the variables I'm having trouble with, I've attached an Excel file with just those variables so you can see if I've missed anything.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Dec 2021 20:24:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/SAS-Changing-Dates-After-Conversion-from-Character-Variable-for/m-p/783769#M10308</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-12-02T20:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Changing Dates After Conversion from Character Variable for Only Some Variables</title>
      <link>https://communities.sas.com/t5/SAS-Studio/SAS-Changing-Dates-After-Conversion-from-Character-Variable-for/m-p/783780#M10309</link>
      <description>&lt;P&gt;Thanks, that worked! I was making an extra step for myself.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Dec 2021 21:03:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/SAS-Changing-Dates-After-Conversion-from-Character-Variable-for/m-p/783780#M10309</guid>
      <dc:creator>leackell13</dc:creator>
      <dc:date>2021-12-02T21:03:07Z</dc:date>
    </item>
  </channel>
</rss>

