<?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 Convert Date from Category to Measure in SAS Viya</title>
    <link>https://communities.sas.com/t5/SAS-Viya/Convert-Date-from-Category-to-Measure/m-p/739888#M938</link>
    <description>&lt;P&gt;Hello!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to SAS VA and am stuck on something that seems like it should be simple but I cannot figure it out. I uploaded a data set and the date column was converted to a category instead of a measure. The date fields read like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2021.04.19 9:03&lt;/P&gt;&lt;P&gt;2021.04.21 7:22&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am try to convert the data item to a measure so it can be treated as a date and formatted to DDMMYYYY.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone able to help me out? Thanks in advance!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 May 2021 20:26:17 GMT</pubDate>
    <dc:creator>abparks_jl</dc:creator>
    <dc:date>2021-05-07T20:26:17Z</dc:date>
    <item>
      <title>Convert Date from Category to Measure</title>
      <link>https://communities.sas.com/t5/SAS-Viya/Convert-Date-from-Category-to-Measure/m-p/739888#M938</link>
      <description>&lt;P&gt;Hello!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to SAS VA and am stuck on something that seems like it should be simple but I cannot figure it out. I uploaded a data set and the date column was converted to a category instead of a measure. The date fields read like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2021.04.19 9:03&lt;/P&gt;&lt;P&gt;2021.04.21 7:22&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am try to convert the data item to a measure so it can be treated as a date and formatted to DDMMYYYY.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone able to help me out? Thanks in advance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 20:26:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/Convert-Date-from-Category-to-Measure/m-p/739888#M938</guid>
      <dc:creator>abparks_jl</dc:creator>
      <dc:date>2021-05-07T20:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Date from Category to Measure</title>
      <link>https://communities.sas.com/t5/SAS-Viya/Convert-Date-from-Category-to-Measure/m-p/739895#M939</link>
      <description>&lt;P&gt;Hello -&amp;nbsp; Try the code below.&amp;nbsp; Assuming your date field is called "date", you can create a new field called "date_want"&amp;nbsp; Basically, the input function will convert your data from character, to the numeric date field.&amp;nbsp; Since your data is currently in yyyy.mm.dd, we need to define that format for SAS with yymmdd10. (10 total characters, in yymmdd order).&amp;nbsp; the Scan function is taking all the records before the space, between your date and what looks like the time.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;date_want = input(scan(date,1," "),yymmdd10.);&lt;BR /&gt;format date_want mmddyy10.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RESULT&lt;/P&gt;&lt;P&gt;date date_want&lt;BR /&gt;2021.04.19 9:03 04/19/2021&lt;BR /&gt;2021.04.21 7:22 04/21/2021&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 20:44:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/Convert-Date-from-Category-to-Measure/m-p/739895#M939</guid>
      <dc:creator>adornodj</dc:creator>
      <dc:date>2021-05-07T20:44:36Z</dc:date>
    </item>
  </channel>
</rss>

