<?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: Hader date issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Hader-date-issue/m-p/615936#M180224</link>
    <description>Hi PaigeMiller,&lt;BR /&gt;Thanks for the quick response&lt;BR /&gt;My Ask is How to remove (-) that symbol in date&lt;BR /&gt;while using compress we can do it but in my case, I'm not able to remove that still, I'm getting the issue&lt;BR /&gt;----------------------------------------&lt;BR /&gt;2020-01-06&lt;BR /&gt;--------------------------------------&lt;BR /&gt;my req is 2020106&lt;BR /&gt;Thankls &amp;amp; Regards&lt;BR /&gt;rohit&lt;BR /&gt;the main problem is</description>
    <pubDate>Wed, 08 Jan 2020 14:24:01 GMT</pubDate>
    <dc:creator>rohitkrishna</dc:creator>
    <dc:date>2020-01-08T14:24:01Z</dc:date>
    <item>
      <title>Hader date issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hader-date-issue/m-p/615931#M180221</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;I facing one issue regarding the hader date, it contains date and time stamp below i mention the input file,&lt;/P&gt;&lt;P&gt;my Req is to remove&amp;nbsp; ifan symbol&amp;nbsp; in the date, I tried multiple scenarios like compress and substr all the things but no use i am facing the issue kindly give sum solutions for the below problem&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;input file&amp;nbsp;&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;H|2020-01-06T14:01:28.0228380Z|1&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;and the sas code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data ls285;&lt;BR /&gt;infile LSFIPYMT;&lt;BR /&gt;Input @1 Hdrrtyp $char1.&lt;BR /&gt;@3 Hdndate $10. /* Header date */&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/189370"&gt;@14&lt;/a&gt; Hdntime $15. /* Header time */&lt;BR /&gt;@32 hdnqty 8.; /* Records in file */&lt;BR /&gt;&lt;BR /&gt;DATA OUT;&lt;BR /&gt;SET LS285;&lt;BR /&gt;FILE LSSOUT28;&lt;BR /&gt;hdndate = substr(hdate,3,10);&lt;BR /&gt;hdndate = compress(hdndate,'-');&lt;BR /&gt;put @1 Hdrrtyp $char1.&lt;BR /&gt;@3 Hdndate $8. /* Header date */&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/189370"&gt;@14&lt;/a&gt; Hdntime $15. /* Header time */&lt;BR /&gt;@32 hdnqty 8.; /* Records in file */&lt;BR /&gt;run;&lt;BR /&gt;proc print data = out;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;----------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;The output has&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Obs&amp;nbsp; &amp;nbsp; Hdrrtyp&amp;nbsp; &amp;nbsp; &amp;nbsp;Hdndate&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Hdntime&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hdnqty&lt;BR /&gt;&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;H&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 14:01:28.022838&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Kindly give some solution for the above one&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rohit&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2020 14:00:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hader-date-issue/m-p/615931#M180221</guid>
      <dc:creator>rohitkrishna</dc:creator>
      <dc:date>2020-01-08T14:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: Hader date issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hader-date-issue/m-p/615933#M180222</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/259823"&gt;@rohitkrishna&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;BR /&gt;my Req is to remove&amp;nbsp; ifan symbol&amp;nbsp; in the date&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't know what "ifan symbol" means.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nevertheless, when dealing with dates and times, you are much better off handling them as numbers (SAS date values and/or SAS time values and/or SAS datetime values) than dealing with them as character strings. The INPUT() function will convert these character strings to numbers for you, and then the FORMAT statement makes them appear understandable to humans.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ls285;
infile cards;
Input @1 Hdrrtyp $char1.
@3 Hdndate $10. /* Header date */
@14 Hdntime $15. /* Header time */
@32 hdnqty 8.; /* Records in file */
hdndate1=input(hdndate,yymmdd10.);
hdntime1=input(hdntime,time.);
format hdntime1 time16.8 hdndate1 yymmdd10.;
cards;
H|2020-01-06T14:01:28.0228380Z|1
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But even simpler, read the character strings in as SAS date/time values in one step using the proper informat, in this case the E8601dt informat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ls285a;
infile cards;
Input @1 Hdrrtyp $char1.
@3 Hdndatetime e8601dt26.6 
@32 hdnqty 8.; /* Records in file */
format hdndatetime datetime24.6;
cards;
H|2020-01-06T14:01:28.0228380Z|1
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2020 14:27:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hader-date-issue/m-p/615933#M180222</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-01-08T14:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Hader date issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hader-date-issue/m-p/615936#M180224</link>
      <description>Hi PaigeMiller,&lt;BR /&gt;Thanks for the quick response&lt;BR /&gt;My Ask is How to remove (-) that symbol in date&lt;BR /&gt;while using compress we can do it but in my case, I'm not able to remove that still, I'm getting the issue&lt;BR /&gt;----------------------------------------&lt;BR /&gt;2020-01-06&lt;BR /&gt;--------------------------------------&lt;BR /&gt;my req is 2020106&lt;BR /&gt;Thankls &amp;amp; Regards&lt;BR /&gt;rohit&lt;BR /&gt;the main problem is</description>
      <pubDate>Wed, 08 Jan 2020 14:24:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hader-date-issue/m-p/615936#M180224</guid>
      <dc:creator>rohitkrishna</dc:creator>
      <dc:date>2020-01-08T14:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Hader date issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hader-date-issue/m-p/615940#M180226</link>
      <description>&lt;P&gt;Make your dates and times numbers as I explained. Then the yymmddn8. format shows no dashes.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2020 14:38:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hader-date-issue/m-p/615940#M180226</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-01-08T14:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: Header date issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hader-date-issue/m-p/615950#M180240</link>
      <description>&lt;P&gt;What you have in your input data is a ISO 8601 formatted timestamp, for which SAS provides the e8601dz informat. Read your data with it, and extract date and time as needed. Then apply display formats as desired:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
infile datalines dlm='|' dsd;
input hdrrtyp :$1. headertime :e8601dz28. hdnqty;
hdndate = datepart(headertime);
hdntime = timepart(headertime);
format
  headertime e8601dz28.6
  hdndate yymmddn8.
  hdntime time8.
;
datalines;
H|2020-01-06T14:01:28.0228380Z|1
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Jan 2020 15:10:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hader-date-issue/m-p/615950#M180240</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-08T15:10:48Z</dc:date>
    </item>
  </channel>
</rss>

