<?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: A numerical variable contains both partial and non-partial iso8601 datetime in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/A-numerical-variable-contains-both-partial-and-non-partial/m-p/364022#M86274</link>
    <description>&lt;P&gt;I&amp;nbsp;agree with &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37783"&gt;@kiranv_&lt;/a&gt;, we could read the data at different rows with the below code but to write it in numeric formats different across different rows in the same column is something not sure if its possible. That too presenting the data in IS8601 format in numeric is not possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input A$20. ;
if prxmatch('m/\d{4}\-\d{2}\-\d{2}\w\d+/',a) then B=input(a,e8601dt.);
else B=input(a,date9.);
cards;
2015-10-30T17:47:00 &amp;nbsp;
17OCT2016 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 03 Jun 2017 15:49:23 GMT</pubDate>
    <dc:creator>Jagadishkatam</dc:creator>
    <dc:date>2017-06-03T15:49:23Z</dc:date>
    <item>
      <title>A numerical variable contains both partial and non-partial iso8601 datetime</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-numerical-variable-contains-both-partial-and-non-partial/m-p/363990#M86262</link>
      <description>&lt;P&gt;obs &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A &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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2015-10-30T17:47:00 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;2015-10-30T17:47:00&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;17OCT2016 &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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;17OCT2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A&amp;nbsp;is a text variable. I want to create B&amp;nbsp;variable to let both partial and non-partial datetime to be in iso8601 format and B&amp;nbsp;should be a numerical variable. Is that possible. Please help! Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jun 2017 07:32:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-numerical-variable-contains-both-partial-and-non-partial/m-p/363990#M86262</guid>
      <dc:creator>heansy</dc:creator>
      <dc:date>2017-06-03T07:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: A numerical variable contains both partial and non-partial iso8601 datetime</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-numerical-variable-contains-both-partial-and-non-partial/m-p/364016#M86269</link>
      <description>&lt;P&gt;&lt;FONT size="5"&gt;&lt;SUP class="reference"&gt;In case of text columns, everything is same, as values are text. But you cannot put different datatypes/formats in a single column for others, as that goes against basic principle of column.&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5"&gt;&lt;SUP class="reference"&gt;Please check the below link for some explanation on this.&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5"&gt;&lt;SUP class="reference"&gt;&lt;A href="https://www.sqa.org.uk/e-learning/SoftDevRDS03CD/page_06.htm" target="_blank"&gt;https://www.sqa.org.uk/e-learning/SoftDevRDS03CD/page_06.htm&lt;/A&gt;&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jun 2017 14:25:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-numerical-variable-contains-both-partial-and-non-partial/m-p/364016#M86269</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-06-03T14:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: A numerical variable contains both partial and non-partial iso8601 datetime</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-numerical-variable-contains-both-partial-and-non-partial/m-p/364022#M86274</link>
      <description>&lt;P&gt;I&amp;nbsp;agree with &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37783"&gt;@kiranv_&lt;/a&gt;, we could read the data at different rows with the below code but to write it in numeric formats different across different rows in the same column is something not sure if its possible. That too presenting the data in IS8601 format in numeric is not possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input A$20. ;
if prxmatch('m/\d{4}\-\d{2}\-\d{2}\w\d+/',a) then B=input(a,e8601dt.);
else B=input(a,date9.);
cards;
2015-10-30T17:47:00 &amp;nbsp;
17OCT2016 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jun 2017 15:49:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-numerical-variable-contains-both-partial-and-non-partial/m-p/364022#M86274</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-06-03T15:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: A numerical variable contains both partial and non-partial iso8601 datetime</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-numerical-variable-contains-both-partial-and-non-partial/m-p/364052#M86290</link>
      <description>&lt;P&gt;Thank you! I try your code and it is really helpfull. If I want to present data in this way as below, is it possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;obs &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A &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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2015-10-30T17:47:00 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;2015-10-30T17:47:00&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;2015-10-30&amp;nbsp;&lt;/SPAN&gt; &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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;2015-10-30&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;B is still numerical and for obs 2nd, it only contains date part but it looks like is8601dt format.&lt;/P&gt;&lt;P&gt;I think what I want is a numerical format which can present partial and non-partial info and it should look like ios8601 format. Thanks again!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input A $20. ;&lt;BR /&gt;if prxmatch('m/\d{4}\-\d{2}\-\d{2}\w\d+/',a) then B=input(a,e8601dt.);&lt;BR /&gt;else B=input(a,is8601da.);&lt;BR /&gt;cards;&lt;BR /&gt;2015-10-30T17:47:00&lt;BR /&gt;2015-10-30&lt;BR /&gt;;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jun 2017 23:25:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-numerical-variable-contains-both-partial-and-non-partial/m-p/364052#M86290</guid>
      <dc:creator>heansy</dc:creator>
      <dc:date>2017-06-03T23:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: A numerical variable contains both partial and non-partial iso8601 datetime</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-numerical-variable-contains-both-partial-and-non-partial/m-p/364076#M86301</link>
      <description>Yes the data is getting converted to numeric we are able to read the data with different dates in same column but the issue is we cannot apply different formats to the same column(Numeric).  &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 04 Jun 2017 03:13:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-numerical-variable-contains-both-partial-and-non-partial/m-p/364076#M86301</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-06-04T03:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: A numerical variable contains both partial and non-partial iso8601 datetime</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-numerical-variable-contains-both-partial-and-non-partial/m-p/364086#M86308</link>
      <description>&lt;P&gt;You cannot change the format attached to a variable from observation to obsevation any more than you could change the name of the variable from observation to observation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you wanted to record the fact that for the second observation the time part is unknown then you need to store that information into another variable. &amp;nbsp;One way you could do that would be by storing the format that you want to use to display it. &amp;nbsp;Then at some point in the future you could use the PUTN() function to generate the strings that you see in column B.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or why not store the date and the time into date and time variables instead of combining them into a singel datetime variable? &amp;nbsp;You could then very easily make a user defined format for the time that will display zero as blanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might also be able to create a user written format, most likely requiring a user written function, that will display the datetime value differently when the timepart is zero. You could then attach that new format to your numeric variable.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/proc/70377/HTML/default/viewer.htm#n1eyyzaux0ze5ln1k03gl338avbj.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/70377/HTML/default/viewer.htm#n1eyyzaux0ze5ln1k03gl338avbj.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Jun 2017 04:09:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-numerical-variable-contains-both-partial-and-non-partial/m-p/364086#M86308</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-06-04T04:09:33Z</dc:date>
    </item>
  </channel>
</rss>

