<?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: PostgreSQL code translate into FEDSQL or SAS in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/PostgreSQL-code-translate-into-FEDSQL-or-SAS/m-p/413834#M12650</link>
    <description>&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See below comments:&lt;/P&gt;&lt;PRE&gt;-- charttime is always null for echoes..
  -- however, the time is available in the echo text, e.g.:
  -- , substring(ne.text, 'Date/Time: [\[\]0-9*-]+ at ([0-9:]+)') as TIMESTAMP
  -- we can therefore impute it and re-create charttime
  , cast(to_timestamp( (to_char( chartdate, 'DD-MM-YYYY' ) || substring(ne.text, 'Date/Time: [\[\]0-9*-]+ at ([0-9:]+)')),
            'DD-MM-YYYYHH24:MI') as timestamp without time zone)
    as charttime&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Also, see below:&lt;/P&gt;&lt;PRE&gt;  -- explanation of below substring:
  --  'Indication: ' - matched verbatim
  --  (.*?) - match any character
  --  \n - the end of the line
  -- substring only returns the item in ()s
  -- note: the '?' makes it non-greedy. if you exclude it, it matches until it reaches the *last* \n

  , substring(ne.text, 'Indication: (.*?)\n') as Indication

  -- sometimes numeric values contain de-id text, e.g. [** Numeric Identifier **]
  -- this removes that text
  , case
      when substring(ne.text, 'Height: \(in\) (.*?)\n') like '%*%'
        then null&lt;/PRE&gt;</description>
    <pubDate>Wed, 15 Nov 2017 22:38:15 GMT</pubDate>
    <dc:creator>Zula</dc:creator>
    <dc:date>2017-11-15T22:38:15Z</dc:date>
    <item>
      <title>PostgreSQL code translate into FEDSQL or SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/PostgreSQL-code-translate-into-FEDSQL-or-SAS/m-p/413829#M12648</link>
      <description>&lt;P&gt;Hi. I would like to write this postgreSQL code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;cast(to_timestamp( (to_char( chartdate, 'DD-MM-YYYY' ) || substring(ne.text, 'Date/Time: [\[\]0-9*-]+ at ([0-9:]+)')),
            'DD-MM-YYYYHH24:MI') as timestamp without time zone)
    as charttime&lt;/PRE&gt;&lt;P&gt;INTO FEDSQL or SAS SQL. Can anyone help?&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 22:27:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/PostgreSQL-code-translate-into-FEDSQL-or-SAS/m-p/413829#M12648</guid>
      <dc:creator>Zula</dc:creator>
      <dc:date>2017-11-15T22:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: PostgreSQL code translate into FEDSQL or SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/PostgreSQL-code-translate-into-FEDSQL-or-SAS/m-p/413832#M12649</link>
      <description>&lt;P&gt;You'll get faster responses if you post what the data looks like and what you need it to do instead. Some test data is helpful either way.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;A rough guess, you're parsing some text field to get the time or date component, not sure.&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/101057"&gt;@Zula&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi. I would like to write this postgreSQL code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;cast(to_timestamp( (to_char( chartdate, 'DD-MM-YYYY' ) || substring(ne.text, 'Date/Time: [\[\]0-9*-]+ at ([0-9:]+)')),
            'DD-MM-YYYYHH24:MI') as timestamp without time zone)
    as charttime&lt;/PRE&gt;
&lt;P&gt;INTO FEDSQL or SAS SQL. Can anyone help?&lt;/P&gt;
&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 22:32:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/PostgreSQL-code-translate-into-FEDSQL-or-SAS/m-p/413832#M12649</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-15T22:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: PostgreSQL code translate into FEDSQL or SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/PostgreSQL-code-translate-into-FEDSQL-or-SAS/m-p/413834#M12650</link>
      <description>&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See below comments:&lt;/P&gt;&lt;PRE&gt;-- charttime is always null for echoes..
  -- however, the time is available in the echo text, e.g.:
  -- , substring(ne.text, 'Date/Time: [\[\]0-9*-]+ at ([0-9:]+)') as TIMESTAMP
  -- we can therefore impute it and re-create charttime
  , cast(to_timestamp( (to_char( chartdate, 'DD-MM-YYYY' ) || substring(ne.text, 'Date/Time: [\[\]0-9*-]+ at ([0-9:]+)')),
            'DD-MM-YYYYHH24:MI') as timestamp without time zone)
    as charttime&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Also, see below:&lt;/P&gt;&lt;PRE&gt;  -- explanation of below substring:
  --  'Indication: ' - matched verbatim
  --  (.*?) - match any character
  --  \n - the end of the line
  -- substring only returns the item in ()s
  -- note: the '?' makes it non-greedy. if you exclude it, it matches until it reaches the *last* \n

  , substring(ne.text, 'Indication: (.*?)\n') as Indication

  -- sometimes numeric values contain de-id text, e.g. [** Numeric Identifier **]
  -- this removes that text
  , case
      when substring(ne.text, 'Height: \(in\) (.*?)\n') like '%*%'
        then null&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Nov 2017 22:38:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/PostgreSQL-code-translate-into-FEDSQL-or-SAS/m-p/413834#M12650</guid>
      <dc:creator>Zula</dc:creator>
      <dc:date>2017-11-15T22:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: PostgreSQL code translate into FEDSQL or SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/PostgreSQL-code-translate-into-FEDSQL-or-SAS/m-p/414059#M12655</link>
      <description>&lt;P&gt;And the data looks like what before the statements shown? And What is the desired result?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Random bits of syntax descriptions of another language do not always&amp;nbsp;help much with what the appropriate SAS code might be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It also is not clear which bits may be syntax and which might be data file content descriptions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2017 15:56:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/PostgreSQL-code-translate-into-FEDSQL-or-SAS/m-p/414059#M12655</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-11-16T15:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: PostgreSQL code translate into FEDSQL or SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/PostgreSQL-code-translate-into-FEDSQL-or-SAS/m-p/414097#M12656</link>
      <description>Some initial guidance: for cast we use put() for to_char and input() for to_num. This together with SAS formats. Date and rime constants is of nuneric data type but handled via corresponding formats. &lt;BR /&gt;Substr() is the counterpart of substring.&lt;BR /&gt;For the next step, be acquainted with support.sas.com.</description>
      <pubDate>Thu, 16 Nov 2017 18:22:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/PostgreSQL-code-translate-into-FEDSQL-or-SAS/m-p/414097#M12656</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-11-16T18:22:52Z</dc:date>
    </item>
  </channel>
</rss>

