<?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: QueryBuilder &amp;gt; Advanced Expression (Formatting char to date) in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/QueryBuilder-gt-Advanced-Expression-Formatting-char-to-date/m-p/459693#M29612</link>
    <description>&lt;P&gt;Jason,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To follow-up:&amp;nbsp; RW9's comment "&lt;SPAN&gt;What I would say secondly however is that you should really fix the import step" is the best was to address this import issue.&amp;nbsp; Just apply the anydtdte. informat to the .CSV file date-time and it will bring it in as a SAS date-time variable.&amp;nbsp; Then you can create your derived versions in the query-builder.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 03 May 2018 14:41:00 GMT</pubDate>
    <dc:creator>Doc_Duke</dc:creator>
    <dc:date>2018-05-03T14:41:00Z</dc:date>
    <item>
      <title>QueryBuilder &gt; Advanced Expression (Formatting char to date)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/QueryBuilder-gt-Advanced-Expression-Formatting-char-to-date/m-p/459547#M29599</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quite new to SAS EG previously using Alteryx for my data cleansing and totally lost&amp;nbsp;trying to do a simple data type conversion. Due to the point and click nature of the process flow I'd rather pick up how to do the following via Querybuilder as opposed to coding via Program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data extracted from Salesforce where a Date field which looks as such but is read as character after importing the data via CSV.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATE&lt;/P&gt;&lt;P&gt;DD/MM/YYYY HH:MM AM/PRM&lt;/P&gt;&lt;P&gt;eg&lt;/P&gt;&lt;P&gt;2/04/2018 11:58 AM&lt;/P&gt;&lt;P&gt;10/04/2018 3:36 PM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to do is the following to compile some time series insights into the data&lt;/P&gt;&lt;P&gt;- convert the character type of DATE to a date readable by SAS EG. (yymmdd10,)&lt;/P&gt;&lt;P&gt;- determine week number from the year; WEEK(DATE,7.)&lt;/P&gt;&lt;P&gt;- group weeks with Saturday as the start of the week eg 31st March to 6th April would be considered a week.; INTCK/INTNX i believe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've attempted the following&lt;/P&gt;&lt;P&gt;- SUBSTR(t1.DATE,1,10)&amp;nbsp;&lt;/P&gt;&lt;P&gt;slices the first 10 characters to include double digit&amp;nbsp;days of the month&lt;/P&gt;&lt;P&gt;- INPUT(t1.DATE,yymmdd10,)&lt;/P&gt;&lt;P&gt;returns blank with a dot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any tips would be appreciated. Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 06:53:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/QueryBuilder-gt-Advanced-Expression-Formatting-char-to-date/m-p/459547#M29599</guid>
      <dc:creator>jason_tran</dc:creator>
      <dc:date>2018-05-03T06:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: QueryBuilder &gt; Advanced Expression (Formatting char to date)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/QueryBuilder-gt-Advanced-Expression-Formatting-char-to-date/m-p/459558#M29600</link>
      <description>&lt;P&gt;Well, to start with your data is not in yymmdd format is it, so thats why that format does not work.&lt;/P&gt;
&lt;PRE&gt;input(scan(t1.data,1," "),anydtdte.)&lt;/PRE&gt;
&lt;P&gt;Should work, i.e. take first word up to space, then convert to number - note I don't code all in shouting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I would say secondly however is that you should really fix the import step, get the import to read the data correctly, post processing is nethier necessary nor an efficient way of proceeding.&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 08:10:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/QueryBuilder-gt-Advanced-Expression-Formatting-char-to-date/m-p/459558#M29600</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-03T08:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: QueryBuilder &gt; Advanced Expression (Formatting char to date)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/QueryBuilder-gt-Advanced-Expression-Formatting-char-to-date/m-p/459559#M29601</link>
      <description>&lt;P&gt;input() interprets the string, so the format here should match the source, hence DDMMYY. should be used.&lt;/P&gt;
&lt;P&gt;Then you can assign YYMMDD. format to the new variable for display purposes (not necessary to make intnx() or weekday() functions to work).&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 08:10:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/QueryBuilder-gt-Advanced-Expression-Formatting-char-to-date/m-p/459559#M29601</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-05-03T08:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: QueryBuilder &gt; Advanced Expression (Formatting char to date)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/QueryBuilder-gt-Advanced-Expression-Formatting-char-to-date/m-p/459693#M29612</link>
      <description>&lt;P&gt;Jason,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To follow-up:&amp;nbsp; RW9's comment "&lt;SPAN&gt;What I would say secondly however is that you should really fix the import step" is the best was to address this import issue.&amp;nbsp; Just apply the anydtdte. informat to the .CSV file date-time and it will bring it in as a SAS date-time variable.&amp;nbsp; Then you can create your derived versions in the query-builder.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 14:41:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/QueryBuilder-gt-Advanced-Expression-Formatting-char-to-date/m-p/459693#M29612</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2018-05-03T14:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: QueryBuilder &gt; Advanced Expression (Formatting char to date)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/QueryBuilder-gt-Advanced-Expression-Formatting-char-to-date/m-p/459894#M29636</link>
      <description>Just tried manually assigned Date/Time as the type via modifying the import data process but it doesnt recognize and returns . (dot) values for every row</description>
      <pubDate>Thu, 03 May 2018 23:21:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/QueryBuilder-gt-Advanced-Expression-Formatting-char-to-date/m-p/459894#M29636</guid>
      <dc:creator>jason_tran</dc:creator>
      <dc:date>2018-05-03T23:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: QueryBuilder &gt; Advanced Expression (Formatting char to date)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/QueryBuilder-gt-Advanced-Expression-Formatting-char-to-date/m-p/459895#M29637</link>
      <description>This worked for half of the dates.&lt;BR /&gt;Any single date values; 1,2,3,4 etc returns the SAS readable date however any date from the 10th return the dot (.)</description>
      <pubDate>Thu, 03 May 2018 23:29:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/QueryBuilder-gt-Advanced-Expression-Formatting-char-to-date/m-p/459895#M29637</guid>
      <dc:creator>jason_tran</dc:creator>
      <dc:date>2018-05-03T23:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: QueryBuilder &gt; Advanced Expression (Formatting char to date)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/QueryBuilder-gt-Advanced-Expression-Formatting-char-to-date/m-p/459899#M29638</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20359i5FED6E1A874823BE/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Various computed columns attempted and results shown&amp;nbsp;above.&lt;/P&gt;&lt;P&gt;DT&lt;/P&gt;&lt;P&gt;SUBSTRI(t1.data,1,10)&lt;/P&gt;&lt;P&gt;DT2&lt;/P&gt;&lt;P&gt;INPUT(SCAN(t1.date,1," "),ANYDTDTE.)&lt;/P&gt;&lt;P&gt;DT3 (output matches slicing via SUBSTR)&lt;/P&gt;&lt;P&gt;SCAN(t1.date,1," ")&lt;/P&gt;&lt;P&gt;DT4&lt;/P&gt;&lt;P&gt;INPUT(SCAN(t1.date,1" "),DDMMYYw.)&lt;/P&gt;&lt;P&gt;DT5&lt;/P&gt;&lt;P&gt;INPUT(SUBSTR(t1.date,1,10),DDMMYYw.)&lt;/P&gt;&lt;P&gt;DT6&lt;/P&gt;&lt;P&gt;PUT(&lt;SPAN&gt;INPUT(SCAN(t1.date,1" "),DDMMYYw.)YYMMDD10.)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 23:54:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/QueryBuilder-gt-Advanced-Expression-Formatting-char-to-date/m-p/459899#M29638</guid>
      <dc:creator>jason_tran</dc:creator>
      <dc:date>2018-05-03T23:54:06Z</dc:date>
    </item>
  </channel>
</rss>

