- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I want to search my network drive for SAS programs that have a key word I'm looking for. When I was running XP, i could do a search such as *.*sas and it would prompt me for any word I wanted to include in the contents of the file. If I typed "PROC IMPORT" (without the double quotes) I would get all SAS programs that had PROC IMPORT in the program. I have no such luck in Windows 7.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
In command prompt:
Search the H drive for all files with extension of sas for string obs=max
for /r H: %i in (*.sas) do @findstr /i /m "obs=max" "%i"
In sas your could execute this in a filename pipe and then collect all the relevant filenames inside a data step.
filename search pipe 'for /r H: %i in (*.sas) do @findstr /i /m "obs=max" "%i"';
data search_results;
infile search length=_len;
input @1 filepath $varying512. _len;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Actually, the same problem existed in XP, but you apparently had SAS identified as a valid search extension.
I'm still on XP and had to look up how to correct the matter. For anyone interested, you can find the solutions (I chose the one at the bottom of the page that didn't require playing with the registry:
http://www.dslreports.com/faq/9500
And, while I haven't had much experience with Windows 7, I think that you may be able to find the solution at:
http://helpdeskgeek.com/windows-7/windows-7-file-search-indexing-options/
Let the forum know if that corrected the situation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
By default, the Windows 7 search will not examine the contents of the file and the indexing that Art is referring to only works on the file name.
Here is a better link on how to search file contents with Windows 7:
http://lifehacker.com/5666506/set-windows-7-search-to-always-index-file-contents
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying the step in the first post but in the 2nd post I can't find "enabling universal content search" in the Search tab.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I would think that my translate to the "always search file names and contents (this might take several minutes)" option on the search options menu
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
In command prompt:
Search the H drive for all files with extension of sas for string obs=max
for /r H: %i in (*.sas) do @findstr /i /m "obs=max" "%i"
In sas your could execute this in a filename pipe and then collect all the relevant filenames inside a data step.
filename search pipe 'for /r H: %i in (*.sas) do @findstr /i /m "obs=max" "%i"';
data search_results;
infile search length=_len;
input @1 filepath $varying512. _len;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This is excellent! When I searched the H drive it worked great. I'm not sure what to do with the part that starts with "filename search pipe......"
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It is only necessary if you wanted to perform the search through sas and have the results returned in a data set. Also there is a typo in my code len=_len should read length=_len.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Holy s**t!! This is incredible. Once I corrected your typo, off she flew. I can play Traffic Rush the rest of the day.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Gregg,
I have a complaint to raise! How could FriedEgg provide such an incredible finding, but you credit yourself for having provided the answer? Am I missing something here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Apparently I don't know all the intricasies of this site but I take no credit for the solution. Fried Egg is the top dog on this topic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Gregg,
Understood. It is a fairly new model for the site and there aren't a lot of initricasies. Simply bring up his post and click on the "correct" button or, if that is no longer available, the "helpful" button. Except for the handful of
SAS employees that are here, the majority of respondents are just other users like you and me. The formal recognition they get is through obtaining approval ratings from their peers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I ran into a similar problem and my solution was to build a SAS macro that would search within sas programs to find the string.
Here is a link to the macro that my colleague and I wrote.
http://www.torsas.ca/attachments/File/09162011/macro-that-hunts.txt
You should be able to put in the drive/directory you want to search, the file type (in this case .sas) and the string you want to look for. Keep the proc printto statements as we found the macro ran a lot faster.
Hope that helps and is what you are looking for.