<?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: How do I get output of GREP command in SAS. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-output-of-GREP-command-in-SAS/m-p/269623#M269428</link>
    <description>&lt;P&gt;See this thread for a very similar question&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/Obtaining-quot-Shell-Output-quot-in-sas-with-SAS-function-quot/m-p/269120" target="_blank"&gt;https://communities.sas.com/t5/Base-SAS-Programming/Obtaining-quot-Shell-Output-quot-in-sas-with-SAS-function-quot/m-p/269120&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 11 May 2016 03:57:57 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-05-11T03:57:57Z</dc:date>
    <item>
      <title>How do I get output of GREP command in SAS.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-output-of-GREP-command-in-SAS/m-p/269615#M269426</link>
      <description>&lt;P&gt;Hi, Im running some GREP commands and was&amp;nbsp;wondering if I can execute GREP command from SAS and the output&amp;nbsp;is directed directly into SAS dataset instead of text file&amp;nbsp;followed by import. Pls guide.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 03:04:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-output-of-GREP-command-in-SAS/m-p/269615#M269426</guid>
      <dc:creator>aj34321</dc:creator>
      <dc:date>2016-05-11T03:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get output of GREP command in SAS.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-output-of-GREP-command-in-SAS/m-p/269617#M269427</link>
      <description>Try filename pipe.</description>
      <pubDate>Wed, 11 May 2016 03:38:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-output-of-GREP-command-in-SAS/m-p/269617#M269427</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-05-11T03:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get output of GREP command in SAS.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-output-of-GREP-command-in-SAS/m-p/269623#M269428</link>
      <description>&lt;P&gt;See this thread for a very similar question&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/Obtaining-quot-Shell-Output-quot-in-sas-with-SAS-function-quot/m-p/269120" target="_blank"&gt;https://communities.sas.com/t5/Base-SAS-Programming/Obtaining-quot-Shell-Output-quot-in-sas-with-SAS-function-quot/m-p/269120&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 03:57:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-output-of-GREP-command-in-SAS/m-p/269623#M269428</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-11T03:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get output of GREP command in SAS.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-output-of-GREP-command-in-SAS/m-p/269639#M269429</link>
      <description>Thank you LinusH. filename pipe works like anything..</description>
      <pubDate>Wed, 11 May 2016 05:40:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-output-of-GREP-command-in-SAS/m-p/269639#M269429</guid>
      <dc:creator>aj34321</dc:creator>
      <dc:date>2016-05-11T05:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get output of GREP command in SAS.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-output-of-GREP-command-in-SAS/m-p/269640#M269430</link>
      <description>Thank you Reeza.. filename pipe worked for me...</description>
      <pubDate>Wed, 11 May 2016 05:41:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-output-of-GREP-command-in-SAS/m-p/269640#M269430</guid>
      <dc:creator>aj34321</dc:creator>
      <dc:date>2016-05-11T05:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get output of GREP command in SAS.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-output-of-GREP-command-in-SAS/m-p/269645#M269431</link>
      <description>&lt;P&gt;Hi Linus, Although the code is working but I think I'm doing something wrong in this.&lt;/P&gt;
&lt;P&gt;Below is the command I run from unix and I get 300 rows for this sample pattern.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;grep -H -R 'real time' /path/pattern_2016*&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In SAS i have written this&amp;nbsp;below macro&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt; filename grep_src pipe "grep -H -R &amp;amp;gpattern. &amp;amp;grep_path.&amp;amp;gfilter.";&lt;BR /&gt; data grep_&amp;amp;glev._&amp;amp;gstream.;&lt;BR /&gt; infile grep_src;&lt;BR /&gt; length runtime_str $ 300;&lt;BR /&gt; input runtime_str $ 300.;&lt;BR /&gt; run;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the output is exactly half of the rows when compared with actual unix&amp;nbsp;executed grep command.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you think the issue may be?&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 06:33:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-output-of-GREP-command-in-SAS/m-p/269645#M269431</guid>
      <dc:creator>aj34321</dc:creator>
      <dc:date>2016-05-11T06:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get output of GREP command in SAS.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-output-of-GREP-command-in-SAS/m-p/269777#M269432</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37860"&gt;@aj34321&lt;/a&gt; wrote:&lt;BR /&gt;(...)
&lt;P&gt;And the output is exactly half of the rows when compared with actual unix&amp;nbsp;executed grep command.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you think the issue may be?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37860"&gt;@aj34321&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your log contains the note&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;NOTE: SAS went to a new line when INPUT statement reached past the end of a line.&lt;/PRE&gt;
&lt;P&gt;doesn't it? This is because with formatted input (&lt;FONT face="courier new,courier"&gt;input runtime_str &lt;STRONG&gt;$300.&lt;/STRONG&gt;;&lt;/FONT&gt;) and the default option FLOWOVER, SAS attempts to read more data from the next record when the record length is less than the format length (here: 300). But this doesn't make sense here and fails. Thus, only &lt;EM&gt;one&lt;/EM&gt; output record is created per&amp;nbsp;&lt;EM&gt;two&lt;/EM&gt; input records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just add the &lt;A href="http://support.sas.com/documentation/cdl//en/lestmtsref/68024/HTML/default/viewer.htm#n1rill4udj0tfun1fvce3j401plo.htm#p1w53eurb5rzvsn1sf102hn7ticw" target="_blank"&gt;TRUNCOVER&lt;/A&gt; option to your INFILE statement and everything should be fine:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;infile grep_src truncover;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 16:07:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-output-of-GREP-command-in-SAS/m-p/269777#M269432</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-11T16:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get output of GREP command in SAS.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-output-of-GREP-command-in-SAS/m-p/269984#M269433</link>
      <description>&lt;P&gt;Yes that was&amp;nbsp;missing and it works...&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 07:13:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-output-of-GREP-command-in-SAS/m-p/269984#M269433</guid>
      <dc:creator>aj34321</dc:creator>
      <dc:date>2016-05-12T07:13:58Z</dc:date>
    </item>
  </channel>
</rss>

