<?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 Date value to numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-value-to-numeric/m-p/667461#M199874</link>
    <description>&lt;P&gt;Which character value should arrive in the database for the SAS date value 1972-04-26?&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jul 2020 15:03:04 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-07-07T15:03:04Z</dc:date>
    <item>
      <title>SAS Date value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-value-to-numeric/m-p/667459#M199873</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Previously we had a sas code to load the date values into the numeric column in database. Like in the sas dataset . the date value is 19720426 and when it is appending to the database which has numeric (11,0) datatype, it has been loaded as 4499.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which format has been used in default&amp;nbsp; in proc append for this conversion ??&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Problem is now I want to use the same dataset and load into a text value .I want to have that date column as numeric. I tried with few format option, but no luck.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let me know to rectify this issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2020 14:58:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-value-to-numeric/m-p/667459#M199873</guid>
      <dc:creator>helannivas88</dc:creator>
      <dc:date>2020-07-07T14:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-value-to-numeric/m-p/667461#M199874</link>
      <description>&lt;P&gt;Which character value should arrive in the database for the SAS date value 1972-04-26?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2020 15:03:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-value-to-numeric/m-p/667461#M199874</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-07T15:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-value-to-numeric/m-p/667463#M199875</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/182470"&gt;@helannivas88&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Previously we had a sas code to load the date values into the numeric column in database. Like in the sas dataset . the date value is 19720426 and when it is appending to the database which has numeric (11,0) datatype, it has been loaded as 4499.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;19720426 is &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;not&lt;/STRONG&gt; &lt;/FONT&gt;a SAS date value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It may represent April 26, 1972. If so, it must be converted to an actual SAS date value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;value=19720426;
datevalue = input(put(value,8.),yymmdd8.);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you convert the value to an actual SAS date value, then I think this resolves the rest of your issues. But, I'll leave that up to you.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2020 15:09:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-value-to-numeric/m-p/667463#M199875</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-07T15:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-value-to-numeric/m-p/667638#M199975</link>
      <description>Sorry, I dont want any char value. In the SAS dataset, the date value is 26Apr1972 but it was wrongly designed in the database for that date column as numeric data type , so the date value had been loaded as 4499 before.&lt;BR /&gt;&lt;BR /&gt;From the same dataset, I want to create a .txt file using proc export. When I do that , 26Apr1972 has been loaded in the .txt file, which I dont want . I want to convert that date into numeric before loading into the .txt file.</description>
      <pubDate>Wed, 08 Jul 2020 06:41:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-value-to-numeric/m-p/667638#M199975</guid>
      <dc:creator>helannivas88</dc:creator>
      <dc:date>2020-07-08T06:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-value-to-numeric/m-p/667641#M199978</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/182470"&gt;@helannivas88&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Sorry, I dont want any char value. In the SAS dataset, the date value is 26Apr1972 but it was wrongly designed in the database for that date column as numeric data type , so the date value had been loaded as 4499 before.&lt;BR /&gt;&lt;BR /&gt;From the same dataset, I want to create a .txt file using proc export. When I do that , 26Apr1972 has been loaded in the .txt file, which I dont want . I want to convert that date into numeric before loading into the .txt file.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A text file has no numbers, only text. TEXT.&lt;/P&gt;
&lt;P&gt;Which means that the SAS number 19720426 and the SAS character value "19720426" will end up as the string 19720426 in the text file.&lt;/P&gt;
&lt;P&gt;Proof:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
date = "26apr1972"d;
format date yymmddn8.;
run;

filename a temp;

data _null_;
file a dlm="|";
set have;
d1 = put(date,yymmddn8.); /* character */
d2 = input(put(date,yymmddn8.),8.); /* number */
put date d1 d2;
run;

data check;
infile a;
input;
check = _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Jul 2020 07:18:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-value-to-numeric/m-p/667641#M199978</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-08T07:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-value-to-numeric/m-p/667643#M199979</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/182470"&gt;@helannivas88&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Sorry, I dont want any char value. In the SAS dataset, the date value is 26Apr1972 but it was wrongly designed in the database for that date column as numeric data type , so the date value had been loaded as 4499 before.&lt;BR /&gt;&lt;BR /&gt;From the same dataset, I want to create a .txt file using proc export. When I do that , 26Apr1972 has been loaded in the .txt file, which I dont want . I want to convert that date into numeric before loading into the .txt file.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A text file has no numbers, only text. TEXT.&lt;/P&gt;
&lt;P&gt;Which means that the SAS number 19720426 and the SAS character value "19720426" will end up as the string 19720426 in the text file.&lt;/P&gt;
&lt;P&gt;Proof:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
date = "26apr1972"d;
format date yymmddn8.;
run;

filename a temp;

data _null_;
file a dlm="|";
set have;
d1 = put(date,yymmddn8.); /* character */
d2 = input(put(date,yymmddn8.),8.); /* number */
put date d1 d2;
run;

data check;
infile a;
input;
check = _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Jul 2020 07:26:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-value-to-numeric/m-p/667643#M199979</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-08T07:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-value-to-numeric/m-p/667683#M199997</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/182470"&gt;@helannivas88&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Sorry, I dont want any char value. In the SAS dataset, the date value is 26Apr1972 but it was wrongly designed in the database for that date column as numeric data type , so the date value had been loaded as 4499 before.&lt;BR /&gt;&lt;BR /&gt;From the same dataset, I want to create a .txt file using proc export. When I do that , 26Apr1972 has been loaded in the .txt file, which I dont want . I want to convert that date into numeric before loading into the .txt file.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There's a huge amount of mis-statements above. 26Apr1972 is represented in SAS (and many other softwares) as 4499. Dates must be numeric integers that represent the number of days since January 1, 1960, that's how 4499 is determined. So a numeric 4499 is correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As pointed out by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;, in a text file, everything is text. If you something that LOOKS LIKE a numeric integer in your text file, you can use the proper format in SAS when creating the text file, for example yymmdd8, which will make 4499 look like 19720426.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jul 2020 11:56:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-value-to-numeric/m-p/667683#M199997</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-08T11:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-value-to-numeric/m-p/667696#M200004</link>
      <description>&lt;P&gt;yymmddN8.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jul 2020 13:09:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-value-to-numeric/m-p/667696#M200004</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-07-08T13:09:24Z</dc:date>
    </item>
  </channel>
</rss>

