<?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: Year showing up correctly on SAS but not in Excel export in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829451#M35540</link>
    <description>Lesson learned, thanks again &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
    <pubDate>Fri, 19 Aug 2022 20:44:03 GMT</pubDate>
    <dc:creator>hayesk</dc:creator>
    <dc:date>2022-08-19T20:44:03Z</dc:date>
    <item>
      <title>Year showing up correctly on SAS but not in Excel export</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829411#M35527</link>
      <description>&lt;P&gt;I have a large dataset with 3 variables to comprise a date: Q2_Today_date_month, Q2_1_Today_date_day, Q2_2_Today_date_year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The values for the month and day are showing up correctly, but the value for the year appears correct on the SAS output but after the proc export to an Excel workbook, the year changes to a 3-digit value of 120 or 121. The years should be between 2019-2021.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In SAS, the year variable is just a regular numeric variable. When I try to format it to a date, it becomes 1960. I know the year 1960 is the default SAS year but I'm confused how numeric values of 2019, 2020, and 2021 are translating to a year of 1960. I'm not sure if the solution is changing the format in Excel or in SAS since it appears correct in SAS but then gets messed up when opening the dataset in Excel. Any guidance is greatly appreciated, thanks!&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 19 Aug 2022 18:49:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829411#M35527</guid>
      <dc:creator>hayesk</dc:creator>
      <dc:date>2022-08-19T18:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: Year showing up correctly on SAS but not in Excel export</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829418#M35528</link>
      <description>&lt;P&gt;A numeric value of 2000-something would be a SAS date in 1966 or 1967 (2000+ days after 1960-01-01).&lt;/P&gt;
&lt;P&gt;A date in 1960 can only result from values below 366.&lt;/P&gt;
&lt;P&gt;So it seems your actual values &lt;EM&gt;are&lt;/EM&gt; in the three-digit range and only displayed differently because of a special format.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 19:07:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829418#M35528</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-08-19T19:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: Year showing up correctly on SAS but not in Excel export</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829425#M35529</link>
      <description>Hmm… the data is being downloaded from a survey on Qualtrics and the only response choices are in 4-digit numeric years. There’s also no special format Im applying to the variable. If I import the data file into SAS and immediately print the dataset, the year shows up as 2019, 2020, or 2021. Unsure how it could be importing as a 3 digit value but SAS still somehow reads the numeric value as the correct year but then it gets all messed up in the date reformatting. I’m a new user by the way so if you have any advice on how you would proceed that would be really helpful! Thanks!</description>
      <pubDate>Fri, 19 Aug 2022 19:18:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829425#M35529</guid>
      <dc:creator>hayesk</dc:creator>
      <dc:date>2022-08-19T19:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: Year showing up correctly on SAS but not in Excel export</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829426#M35530</link>
      <description>&lt;P&gt;Please post your code used to export to Excel.&lt;/P&gt;
&lt;P&gt;If in doubt, write the data to a semicolon-delimited file with extension .csv, then look at that file with a text editor before reading it with Excel.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 19:29:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829426#M35530</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-08-19T19:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Year showing up correctly on SAS but not in Excel export</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829427#M35531</link>
      <description>&lt;P&gt;What is the format/type on the year column in SAS?&lt;/P&gt;
&lt;P&gt;What is the format/display of the column in Excel?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 19:29:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829427#M35531</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-08-19T19:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Year showing up correctly on SAS but not in Excel export</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829438#M35532</link>
      <description>&lt;P&gt;Here is the output from the proc contents for the year variable:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Variable&lt;/TD&gt;&lt;TD&gt;Type&lt;/TD&gt;&lt;TD&gt;Length&lt;/TD&gt;&lt;TD&gt;Format&lt;/TD&gt;&lt;TD&gt;Informat&lt;/TD&gt;&lt;TD&gt;Label&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Q2_2_Today_date_year&lt;/TD&gt;&lt;TD&gt;Num&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;Q2_2_TOA.&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Today's date: - Year&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;In Excel,&amp;nbsp; the column format just says "General" but if I change it to date then it makes it 1900. And all the values in that column are 120 or 121 as I mentioned but in SAS it shows up as the correct years (2019, 2020, 2021)&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV align="center"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV align="center"&gt;&lt;DIV class=""&gt;&lt;DIV align="center"&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 19 Aug 2022 19:53:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829438#M35532</guid>
      <dc:creator>hayesk</dc:creator>
      <dc:date>2022-08-19T19:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: Year showing up correctly on SAS but not in Excel export</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829440#M35533</link>
      <description>&lt;PRE&gt;&lt;CODE class=""&gt;proc export data=qd outfile='G:...'
	dbms=xlsx replace;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here's my export code, I redacted the file location and name but that would normally be there in place of the '...'.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I followed your advice and exported it as csv and then read in a text editor and the year is&amp;nbsp;&lt;EM&gt;still&amp;nbsp;&lt;/EM&gt;showing up correctly there! Not sure where it's all going wrong&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 20:01:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829440#M35533</guid>
      <dc:creator>hayesk</dc:creator>
      <dc:date>2022-08-19T20:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Year showing up correctly on SAS but not in Excel export</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829442#M35534</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=YourDatasetName;
table q2_2_today_year_num;
format q2_2_today_year_num 8.;
run;

proc format cntlout=want;
select Q2_2_TOA;
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What does that show? Can you show the output?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 20:05:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829442#M35534</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-08-19T20:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: Year showing up correctly on SAS but not in Excel export</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829445#M35535</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/276858"&gt;@hayesk&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Here is the output from the proc contents for the year variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE cellspacing="0" cellpadding="5"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;Variable&lt;/TD&gt;
&lt;TD&gt;Type&lt;/TD&gt;
&lt;TD&gt;Length&lt;/TD&gt;
&lt;TD&gt;Format&lt;/TD&gt;
&lt;TD&gt;Informat&lt;/TD&gt;
&lt;TD&gt;Label&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Q2_2_Today_date_year&lt;/TD&gt;
&lt;TD&gt;Num&lt;/TD&gt;
&lt;TD&gt;8&lt;/TD&gt;
&lt;TD&gt;Q2_2_TOA.&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;Today's date: - Year&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;In Excel,&amp;nbsp; the column format just says "General" but if I change it to date then it makes it 1900. And all the values in that column are 120 or 121 as I mentioned but in SAS it shows up as the correct years (2019, 2020, 2021)&lt;/P&gt;
&lt;DIV class=""&gt;
&lt;DIV align="center"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class=""&gt;
&lt;DIV align="center"&gt;
&lt;DIV class=""&gt;
&lt;DIV align="center"&gt;
&lt;DIV class=""&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So you do have a non-standard format (Q2_2_TOA) which displays the internal value as 4-digit years.&lt;/P&gt;
&lt;P&gt;Since PROC EXPORT does recognize this column only as a simple number, the raw value ends up in Excel.&lt;/P&gt;
&lt;P&gt;By using a text file where you PUT the formatted value, you can avoid this.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 20:16:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829445#M35535</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-08-19T20:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Year showing up correctly on SAS but not in Excel export</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829446#M35536</link>
      <description>&lt;P&gt;I'm attaching the output as a document but I think you just helped me figure it out! Should I just reformat these to equal the year or use if statements or what do you recommend?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 20:16:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829446#M35536</guid>
      <dc:creator>hayesk</dc:creator>
      <dc:date>2022-08-19T20:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: Year showing up correctly on SAS but not in Excel export</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829447#M35537</link>
      <description>&lt;P&gt;Convert your variable before exporting:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data qd_ex;
set qd (rename=(Q2_2_Today_date_year=_year));
Q2_2_Today_date_year = input(put(_year,q2_2_toa.),4.);
drop _year;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Aug 2022 20:32:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829447#M35537</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-08-19T20:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Year showing up correctly on SAS but not in Excel export</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829449#M35538</link>
      <description>&lt;P&gt;IT WORKED!!! Thank you so much you saved me at work &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 20:36:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829449#M35538</guid>
      <dc:creator>hayesk</dc:creator>
      <dc:date>2022-08-19T20:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: Year showing up correctly on SAS but not in Excel export</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829450#M35539</link>
      <description>&lt;P&gt;This whole thread is a nice illustration for my Maxim 3: Know Your Data.&lt;/P&gt;
&lt;P&gt;And may I quote myself from my first post in this thread:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;So it seems your actual values&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;are&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;in the three-digit range and only displayed differently because of a &lt;FONT color="#FF0000"&gt;special format&lt;/FONT&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Fri, 19 Aug 2022 20:42:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829450#M35539</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-08-19T20:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Year showing up correctly on SAS but not in Excel export</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829451#M35540</link>
      <description>Lesson learned, thanks again &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Fri, 19 Aug 2022 20:44:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Year-showing-up-correctly-on-SAS-but-not-in-Excel-export/m-p/829451#M35540</guid>
      <dc:creator>hayesk</dc:creator>
      <dc:date>2022-08-19T20:44:03Z</dc:date>
    </item>
  </channel>
</rss>

