<?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: Datastep2: converting string to timestamp in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Datastep2-converting-string-to-timestamp/m-p/895190#M353646</link>
    <description>&lt;P&gt;Have you investigated using functions?&lt;/P&gt;
&lt;P&gt;Ex.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc ds2;
data _null_; 
   dcl date ds2d having format YYMMDD10.;
   dcl time ds2t having format TIME18.9;
   dcl timestamp ds2dt having format DATETIME28.9;
   dcl double d t ts;
   method init();
      d = 19358;
      ds2d = to_date(d);
      ds2t = to_time(d);
      ds2dt = to_timestamp(d);
      put ds2d= ds2t= ds2dt=;
   end;
enddata;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This doesn't solve the issue for converting the datetime string though. Sorry.&lt;/P&gt;</description>
    <pubDate>Thu, 21 Sep 2023 09:09:10 GMT</pubDate>
    <dc:creator>JosvanderVelden</dc:creator>
    <dc:date>2023-09-21T09:09:10Z</dc:date>
    <item>
      <title>Datastep2: converting string to timestamp</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datastep2-converting-string-to-timestamp/m-p/895185#M353643</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I'm struggling with converting a string to a timestamp.&lt;BR /&gt;This is quite easy in normal Datastep, but not for me in DS2.&lt;BR /&gt;How would I have to modify the DS2 code so that I get the same result as in the normal datastep, CreationDate_n field.&lt;BR /&gt;Many thanks for your help!&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data Testdaten;
    attrib
           CreationDate_c length= $40 
           CreationDate_n length= 8   format=DATETIME25.6;


    CreationDate_c='2023-09-14T07:07:41+02:00';
    CreationDate_n=input(CreationDate_c,ANYDTDTM.);

run;


proc ds2;
data _null_;

    dcl timestamp CreationDate having format DATETIME25.6;

    method run();
        set Testdaten;

            CreationDate= inputn(CreationDate_c,'ANYDTDTM.') ;

            put CreationDate=;

    end;
enddata;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Sep 2023 07:29:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datastep2-converting-string-to-timestamp/m-p/895185#M353643</guid>
      <dc:creator>Robert_</dc:creator>
      <dc:date>2023-09-21T07:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: Datastep2: converting string to timestamp</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datastep2-converting-string-to-timestamp/m-p/895190#M353646</link>
      <description>&lt;P&gt;Have you investigated using functions?&lt;/P&gt;
&lt;P&gt;Ex.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc ds2;
data _null_; 
   dcl date ds2d having format YYMMDD10.;
   dcl time ds2t having format TIME18.9;
   dcl timestamp ds2dt having format DATETIME28.9;
   dcl double d t ts;
   method init();
      d = 19358;
      ds2d = to_date(d);
      ds2t = to_time(d);
      ds2dt = to_timestamp(d);
      put ds2d= ds2t= ds2dt=;
   end;
enddata;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This doesn't solve the issue for converting the datetime string though. Sorry.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 09:09:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datastep2-converting-string-to-timestamp/m-p/895190#M353646</guid>
      <dc:creator>JosvanderVelden</dc:creator>
      <dc:date>2023-09-21T09:09:10Z</dc:date>
    </item>
  </channel>
</rss>

