<?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: command x to search for string in files in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/command-x-to-search-for-string-in-files/m-p/529038#M144480</link>
    <description>&lt;P&gt;Sorry &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; , i'ts windows environment : we have just find or findstr choice instead of grep. it's work in a specific repository and not in all the workspaces files .&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/77163"&gt;@Oligolas&lt;/a&gt;&amp;nbsp;: i found this solution in&amp;nbsp;&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Searching-SAS-files-including-key-words-in-Windows-7/td-p/17896" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/Searching-SAS-files-including-key-words-in-Windows-7/td-p/17896&lt;/A&gt; :&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;for /r H: %i in (*.sas) do @findstr /i /m "obs=max" "%i"&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but to replace H: by my macro-variable environment and var didn't work. i continue my resarch&amp;nbsp; !&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Jan 2019 13:59:29 GMT</pubDate>
    <dc:creator>amager</dc:creator>
    <dc:date>2019-01-22T13:59:29Z</dc:date>
    <item>
      <title>command x to search for string in files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/command-x-to-search-for-string-in-files/m-p/529014#M144471</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to search for a string in files , i use find or findstr command x but no result.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone have a solution to this ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options noxwait; 
x " find ""data"" ""path/*.sas"""; 

/*or*/

sysexec(find "data" "path/*.sas"); 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks .&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 11:13:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/command-x-to-search-for-string-in-files/m-p/529014#M144471</guid>
      <dc:creator>amager</dc:creator>
      <dc:date>2019-01-22T11:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: command x to search for string in files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/command-x-to-search-for-string-in-files/m-p/529015#M144472</link>
      <description>&lt;P&gt;Hi, is there a particular reason you want to use the x command?&lt;/P&gt;&lt;P&gt;and did you try to search in the &lt;A href="https://communities.sas.com/t5/SAS-Procedures/Searching-SAS-files-including-key-words-in-Windows-7/td-p/17896" target="_blank"&gt;Forum&lt;/A&gt;?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 11:36:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/command-x-to-search-for-string-in-files/m-p/529015#M144472</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2019-01-22T11:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: command x to search for string in files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/command-x-to-search-for-string-in-files/m-p/529031#M144477</link>
      <description>&lt;P&gt;Since you are using forward slashes, I take it your SAS runs on a UNIX platform. In that case, the tool of choice is grep:&lt;/P&gt;
&lt;PRE&gt;grep "string" path/*.sas&lt;/PRE&gt;
&lt;P&gt;To retrieve the result in SAS, do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename oscmd pipe 'grep "string" path/*.sas 2&amp;gt;&amp;amp;1';

data found_strings;
infile oscmd truncover;
input found_line $200.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In case something fails, the 2&amp;gt;&amp;amp;1 will make sure that error messages end up in your dataset in place of the result.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 12:56:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/command-x-to-search-for-string-in-files/m-p/529031#M144477</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-22T12:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: command x to search for string in files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/command-x-to-search-for-string-in-files/m-p/529038#M144480</link>
      <description>&lt;P&gt;Sorry &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; , i'ts windows environment : we have just find or findstr choice instead of grep. it's work in a specific repository and not in all the workspaces files .&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/77163"&gt;@Oligolas&lt;/a&gt;&amp;nbsp;: i found this solution in&amp;nbsp;&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Searching-SAS-files-including-key-words-in-Windows-7/td-p/17896" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/Searching-SAS-files-including-key-words-in-Windows-7/td-p/17896&lt;/A&gt; :&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;for /r H: %i in (*.sas) do @findstr /i /m "obs=max" "%i"&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but to replace H: by my macro-variable environment and var didn't work. i continue my resarch&amp;nbsp; !&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 13:59:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/command-x-to-search-for-string-in-files/m-p/529038#M144480</guid>
      <dc:creator>amager</dc:creator>
      <dc:date>2019-01-22T13:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: command x to search for string in files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/command-x-to-search-for-string-in-files/m-p/529072#M144494</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11076"&gt;@amager&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a simple example that works in my Windows 7 environment: A case-insensitive search for the phrase "proc print" in all *.sas files in directory C:\Temp\SAS. The search results are stored as character strings in dataset WANT.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename test pipe 'findstr /i/c:"proc print" C:\Temp\SAS\*.sas';

data want;
infile test truncover;
input c $300.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If there were, e.g., *.sas&lt;EM&gt;7bdat &lt;/EM&gt;files (i.e. SAS datasets) in the same directory, they would be searched as well (annoying Windows "feature").&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 15:11:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/command-x-to-search-for-string-in-files/m-p/529072#M144494</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-01-22T15:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: command x to search for string in files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/command-x-to-search-for-string-in-files/m-p/529081#M144495</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp; Thanks for this answer like a&amp;nbsp;said&amp;nbsp;it's work for me but the problem with 'findstr' don't go in recursive to fetch all repository; i don't know way.&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Eg. if another file in : "C:\Temp\SAS1\" , didn't go back to fetch this repository. so i go for the second solution&amp;nbsp; :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;for /r Z: %i in (*.sas) do @findstr /i /m "data" "%i"&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I can run&amp;nbsp;this command in windows cmd , but i can't run it in my SAS environment if a replace it with something like :&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename x pipe 'for /r "&amp;amp;server_sas/" %i in (*.sas) do @findstr /i /m "data" "%i"'&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT : it's work prefectly with double quote " " :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename x pipe "for /r ""&amp;amp;server_sas/"" %i in (*.sas) do @findstr /i /m ""data"" ""%i"" "&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://communities.sas.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 09:25:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/command-x-to-search-for-string-in-files/m-p/529081#M144495</guid>
      <dc:creator>amager</dc:creator>
      <dc:date>2019-01-23T09:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: command x to search for string in files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/command-x-to-search-for-string-in-files/m-p/529092#M144502</link>
      <description>&lt;P&gt;Have you tried the &lt;FONT face="courier new,courier"&gt;/s&lt;/FONT&gt; option of &lt;FONT face="courier new,courier"&gt;findstr&lt;/FONT&gt;&amp;nbsp;(i.e. search all subfolders, in the below example: &lt;SPAN&gt;subfolders&lt;/SPAN&gt; of C:\Temp, and the folder itself)?&lt;/P&gt;
&lt;PRE&gt;findstr &lt;STRONG&gt;/s&lt;/STRONG&gt;/i/c:"proc print" C:\Temp\*.sas&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Jan 2019 15:46:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/command-x-to-search-for-string-in-files/m-p/529092#M144502</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-01-22T15:46:25Z</dc:date>
    </item>
  </channel>
</rss>

