<?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 Searching a string in various directories in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Searching-a-string-in-various-directories/m-p/919984#M362346</link>
    <description>&lt;P&gt;This program searches for a specific string in various directories on my computer. After running it asks to input a string and also to select a specific directory. I just want this program to search all directories at once so that I don't have to select and search them one by one.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%global fnobs dir ext;
%let ext = SAS;  /*file extension*/
%let string = %UPCASE(&amp;amp;SEARCH_STRING);
%PUT &amp;amp;STRING;
proc datasets nolist;
delete all;
run;
%MACRO SETDIR;
%IF &amp;amp;DBSYS = CboTestEditValidation %THEN
%DO;
			%LET DBSYS=CBO_2324_TEST_EDIT_VALIDATION;
			%LET DIR=\\edw-fs02\CAE_Data\CBO\&amp;amp;Year\Programs;
%END;

%ELSE %IF &amp;amp;DBSYS = CBOSurveyReports %then %do;
	%let dbsys = CBO-Survey-Reports-Programs;
	%LET DIR=\\edw-fs02\CAE_Data\CBO\CBO Survey Reports\&amp;amp;Year;
%end;

%ELSE %IF &amp;amp;DBSYS = WDISPrograms %then %do;
	%let dbsys = WDIS;
	%LET DIR=\\edw-fs02\CAE_Data\WDIS\PRODUCTION\Survey Reports\&amp;amp;Year;
%end;

%ELSE %IF &amp;amp;DBSYS = SECCTEAppendixFF %then %do;
	%let dbsys = Appendix;
	%LET DIR=\\edw-fs02\CAE_Data\APPENDICES_WDIS_SECCTE\SECCTE\FF_appendixff_xls;
%end;

%ELSE %IF &amp;amp;DBSYS = SECCTEAppendixY %then %do;
	%let dbsys = Appendix;
	%LET DIR=\\edw-fs02\CAE_Data\APPENDICES_WDIS_SECCTE\SECCTE\Y_appendixy_xls;
%end;

%ELSE %IF &amp;amp;DBSYS = WDISAppendixH %then %do;
	%let dbsys = Appendix;
	%LET DIR=\\edw-fs02\CAE_Data\APPENDICES_WDIS_SECCTE\WDIS\H_appendixh_xls;
%end;

%ELSE %IF &amp;amp;DBSYS = WDISAppendixO %then %do;
	%let dbsys = Appendix;
	%LET DIR=\\edw-fs02\CAE_Data\APPENDICES_WDIS_SECCTE\WDIS\O_appendixo_xls;
%end;

%ELSE %IF &amp;amp;DBSYS = WDISAppendixP %then %do;
	%let dbsys = Appendix;
	%LET DIR=\\edw-fs02\CAE_Data\APPENDICES_WDIS_SECCTE\WDIS\P_appendixp_xls;
%end;

%ELSE %IF &amp;amp;DBSYS = WDISAppendixQ %then %do;
	%let dbsys = Appendix;
	%LET DIR=\\edw-fs02\CAE_Data\APPENDICES_WDIS_SECCTE\WDIS\Q_appendixq_xls;
%end;

%ELSE %IF &amp;amp;DBSYS = SECCTEWDISAppendixZ %then %do;
	%let dbsys = Appendix;
	%LET DIR=\\edw-fs02\CAE_Data\APPENDICES_WDIS_SECCTE\WDIS_SECCTE_AppendixZ_2324;
%end;

%ELSE %IF &amp;amp;DBSYS = BuildCIPSupportFiles %then %do;
	%let dbsys = Appendix;
	%LET DIR="\\edw-fs02\CAE_Data\CIPS\2023-2024\Build CIP and Support Files";
%end;

%ELSE %IF &amp;amp;DBSYS = 2324WDISReferenceTables %then %do;
	%let dbsys = Appendix;
	%LET DIR=\\edw-fs02\CAE_Data\CIPS\2023-2024\2324 WDIS REFERENCE TABLES;
%end;


/*%ELSE %IF &amp;amp;DBSYS = CBO2324SurveyReports %then %do;
	%let dbsys = CBO-2324-Survey-Reports-Programs;
	%LET DIR=\\edw-fs02\CAE_Data\CBO\CBO Survey Reports\2324;
%end;

%ELSE %IF &amp;amp;DBSYS = CBO2425SurveyReports %then %do;
	%let dbsys = CBO-2425-Survey-Reports-Programs;
	%LET DIR=\\edw-fs02\CAE_Data\CBO\CBO Survey Reports\2425;
%end;

%ELSE %IF &amp;amp;DBSYS = CBO2526SurveyReports %then %do;
	%let dbsys = CBO-2526-Survey-Reports-Programs;
	%LET DIR=\\edw-fs02\CAE_Data\CBO\CBO Survey Reports\2526;
%end;

%ELSE %IF &amp;amp;DBSYS = WDISPrograms2324 %then %do;
	%let dbsys = WDIS-2324;
	%LET DIR=\\edw-fs02\CAE_Data\WDIS\PRODUCTION\Survey Reports\2324;
%end;

%ELSE %IF &amp;amp;DBSYS = WDISPrograms2425 %then %do;
	%let dbsys = WDIS-2425;
	%LET DIR=\\edw-fs02\CAE_Data\WDIS\PRODUCTION\Survey Reports\2425;
%end;

%ELSE %IF &amp;amp;DBSYS = WDISprograms2526 %then %do;
	%let dbsys = WDIS-2526;
	%LET DIR=\\edw-fs02\CAE_Data\WDIS\PRODUCTION\Survey Reports\2526;
%end;*/
%ELSE %LET DIR=\\edw-fs02\CAE_Data\WDIS\PRODUCTION\Survey Reports\2324;

%PUT &amp;amp;DIR;
%MEND SETDIR;
%SETDIR;
RUN;
%MACRO SETOBS (DSET);

	DATA _NULL_;
		DSID=OPEN("&amp;amp;DSET");

		IF (DSID = 0) THEN DO;
			PUT 'FILE NOT OPENED';
		END;
		ELSE DO;
			PUT 'DSET DATA SET HAS BEEN OPENED';
			ISOBS=ATTRN(DSID,'NOBS');

			IF ISOBS GT -1 THEN DO;
				CALL SYMPUT ("FNOBS",RIGHT(PUT(ISOBS,8.)));
			END;
		END;
	RUN;
%MEND SETOBS;
%macro list_members;
	%global dnum;

	data tibco_list(KEEP=filename ext);
		format fref $char8. filename $char256. filetype $char100. CCNUM 8. CCNUMX $char2. colname $char50. sub $char1. trm 1. year $char4. dbtype $char3.
			ext $char3.;
		rc = filename(fref,"&amp;amp;DIR");

		if rc = 0 then
			do;
				did = dopen(fref);
				rc = filename(fref);
			end;
		else
			do;
				length msg $200.;
				msg = sysmsg();
				put msg=;
				did = .;
			end;

		if did &amp;lt;= 0 then
			putlog 'ERR' 'OR: Unable to open directory.';
		dnum = dnum(did);
		call symput("dnum",dnum);
		fcount = 0;
		%PUT &amp;amp;DNUM;

		do j = 1 to dnum;
			filename = dread(did, j);
			putlog filename=;
			fid = mopen(did, filename);
			ext=upcase(scan(filename,-1,'.'));
			NUMDOTS = count(filename,'.');
			putlog numdots=;

			IF ext IN ('SAS', 'egp') THEN
				output tibco_list;
		end;

		rc = dclose(did);
	run;

%mend list_members;

%list_members;
RUN;

%macro readraw;

	%SETOBS(tibco_list);

	DATA tibco_list;
	SET tibco_list NOBS=NOBS;
	RETAIN SEQ;
	SEQ=SUM(SEQ,1);
	RUN;

	%let rc=%sysfunc(filename(fileref,%superq(dir)));
	%let did=%sysfunc(dopen(&amp;amp;fileref));

	%do dmem=1 %to &amp;amp;fnobs;

	   	DATA _NULL_;
		SET tibco_list;
		WHERE SEQ = &amp;amp;dmem;
		CALL SYMPUT("memname",trim(filename));
		RUN;

		*--this is telling the code that we are only interested in files that have an extension of SAS;
		%if %qupcase(%qscan(%superq(memname),-1,.))=&amp;amp;ext. %then
			%do;
				*--depending on the file type you are looking at, you may need another method to read in the file contents;
				data temp;
					length program $3600.;
					infile "&amp;amp;dir.\&amp;amp;memname." truncover;
					input @01 line $char2500.;
					line_num=_n_;
					program="&amp;amp;dir\&amp;amp;memname.";

					if index(upcase(line), "&amp;amp;STRING") &amp;gt; 0 then
						do;
							line_num=_n_;
							program="&amp;amp;dir\&amp;amp;memname.";
							output;
						end;
				run;

				proc append data=temp base=all;
				run;

			%end;
	%end;

	%let dsid = %sysfunc(open(all));

	*-- If the data set exists, then grab the number of observations and variables;
	*-- then close the data seth;
	%if &amp;amp;dsid %then
		%do;
			%let nobs =%sysfunc(attrn(&amp;amp;dsid,nobs));
			%let rc = %sysfunc(close(&amp;amp;dsid));
			%put &amp;amp;nobs;

			%if &amp;amp;nobs &amp;gt; 0 %then
				%do;
					proc print data=all noobs;
						title "Looking for  &amp;amp;string.";
						title2 " &amp;amp;string found in the following programs";
					run;
				%end;
			%else %put NOTE: &amp;amp;string not found in &amp;amp;dir.;
		%end;

	%let didc=%sysfunc(dclose(%nrbquote(&amp;amp;did)));
	%let rc=%sysfunc(filename(fileref));
%mend readraw;

%readraw;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 12 Mar 2024 18:34:17 GMT</pubDate>
    <dc:creator>Carl_1234</dc:creator>
    <dc:date>2024-03-12T18:34:17Z</dc:date>
    <item>
      <title>Searching a string in various directories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Searching-a-string-in-various-directories/m-p/919984#M362346</link>
      <description>&lt;P&gt;This program searches for a specific string in various directories on my computer. After running it asks to input a string and also to select a specific directory. I just want this program to search all directories at once so that I don't have to select and search them one by one.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%global fnobs dir ext;
%let ext = SAS;  /*file extension*/
%let string = %UPCASE(&amp;amp;SEARCH_STRING);
%PUT &amp;amp;STRING;
proc datasets nolist;
delete all;
run;
%MACRO SETDIR;
%IF &amp;amp;DBSYS = CboTestEditValidation %THEN
%DO;
			%LET DBSYS=CBO_2324_TEST_EDIT_VALIDATION;
			%LET DIR=\\edw-fs02\CAE_Data\CBO\&amp;amp;Year\Programs;
%END;

%ELSE %IF &amp;amp;DBSYS = CBOSurveyReports %then %do;
	%let dbsys = CBO-Survey-Reports-Programs;
	%LET DIR=\\edw-fs02\CAE_Data\CBO\CBO Survey Reports\&amp;amp;Year;
%end;

%ELSE %IF &amp;amp;DBSYS = WDISPrograms %then %do;
	%let dbsys = WDIS;
	%LET DIR=\\edw-fs02\CAE_Data\WDIS\PRODUCTION\Survey Reports\&amp;amp;Year;
%end;

%ELSE %IF &amp;amp;DBSYS = SECCTEAppendixFF %then %do;
	%let dbsys = Appendix;
	%LET DIR=\\edw-fs02\CAE_Data\APPENDICES_WDIS_SECCTE\SECCTE\FF_appendixff_xls;
%end;

%ELSE %IF &amp;amp;DBSYS = SECCTEAppendixY %then %do;
	%let dbsys = Appendix;
	%LET DIR=\\edw-fs02\CAE_Data\APPENDICES_WDIS_SECCTE\SECCTE\Y_appendixy_xls;
%end;

%ELSE %IF &amp;amp;DBSYS = WDISAppendixH %then %do;
	%let dbsys = Appendix;
	%LET DIR=\\edw-fs02\CAE_Data\APPENDICES_WDIS_SECCTE\WDIS\H_appendixh_xls;
%end;

%ELSE %IF &amp;amp;DBSYS = WDISAppendixO %then %do;
	%let dbsys = Appendix;
	%LET DIR=\\edw-fs02\CAE_Data\APPENDICES_WDIS_SECCTE\WDIS\O_appendixo_xls;
%end;

%ELSE %IF &amp;amp;DBSYS = WDISAppendixP %then %do;
	%let dbsys = Appendix;
	%LET DIR=\\edw-fs02\CAE_Data\APPENDICES_WDIS_SECCTE\WDIS\P_appendixp_xls;
%end;

%ELSE %IF &amp;amp;DBSYS = WDISAppendixQ %then %do;
	%let dbsys = Appendix;
	%LET DIR=\\edw-fs02\CAE_Data\APPENDICES_WDIS_SECCTE\WDIS\Q_appendixq_xls;
%end;

%ELSE %IF &amp;amp;DBSYS = SECCTEWDISAppendixZ %then %do;
	%let dbsys = Appendix;
	%LET DIR=\\edw-fs02\CAE_Data\APPENDICES_WDIS_SECCTE\WDIS_SECCTE_AppendixZ_2324;
%end;

%ELSE %IF &amp;amp;DBSYS = BuildCIPSupportFiles %then %do;
	%let dbsys = Appendix;
	%LET DIR="\\edw-fs02\CAE_Data\CIPS\2023-2024\Build CIP and Support Files";
%end;

%ELSE %IF &amp;amp;DBSYS = 2324WDISReferenceTables %then %do;
	%let dbsys = Appendix;
	%LET DIR=\\edw-fs02\CAE_Data\CIPS\2023-2024\2324 WDIS REFERENCE TABLES;
%end;


/*%ELSE %IF &amp;amp;DBSYS = CBO2324SurveyReports %then %do;
	%let dbsys = CBO-2324-Survey-Reports-Programs;
	%LET DIR=\\edw-fs02\CAE_Data\CBO\CBO Survey Reports\2324;
%end;

%ELSE %IF &amp;amp;DBSYS = CBO2425SurveyReports %then %do;
	%let dbsys = CBO-2425-Survey-Reports-Programs;
	%LET DIR=\\edw-fs02\CAE_Data\CBO\CBO Survey Reports\2425;
%end;

%ELSE %IF &amp;amp;DBSYS = CBO2526SurveyReports %then %do;
	%let dbsys = CBO-2526-Survey-Reports-Programs;
	%LET DIR=\\edw-fs02\CAE_Data\CBO\CBO Survey Reports\2526;
%end;

%ELSE %IF &amp;amp;DBSYS = WDISPrograms2324 %then %do;
	%let dbsys = WDIS-2324;
	%LET DIR=\\edw-fs02\CAE_Data\WDIS\PRODUCTION\Survey Reports\2324;
%end;

%ELSE %IF &amp;amp;DBSYS = WDISPrograms2425 %then %do;
	%let dbsys = WDIS-2425;
	%LET DIR=\\edw-fs02\CAE_Data\WDIS\PRODUCTION\Survey Reports\2425;
%end;

%ELSE %IF &amp;amp;DBSYS = WDISprograms2526 %then %do;
	%let dbsys = WDIS-2526;
	%LET DIR=\\edw-fs02\CAE_Data\WDIS\PRODUCTION\Survey Reports\2526;
%end;*/
%ELSE %LET DIR=\\edw-fs02\CAE_Data\WDIS\PRODUCTION\Survey Reports\2324;

%PUT &amp;amp;DIR;
%MEND SETDIR;
%SETDIR;
RUN;
%MACRO SETOBS (DSET);

	DATA _NULL_;
		DSID=OPEN("&amp;amp;DSET");

		IF (DSID = 0) THEN DO;
			PUT 'FILE NOT OPENED';
		END;
		ELSE DO;
			PUT 'DSET DATA SET HAS BEEN OPENED';
			ISOBS=ATTRN(DSID,'NOBS');

			IF ISOBS GT -1 THEN DO;
				CALL SYMPUT ("FNOBS",RIGHT(PUT(ISOBS,8.)));
			END;
		END;
	RUN;
%MEND SETOBS;
%macro list_members;
	%global dnum;

	data tibco_list(KEEP=filename ext);
		format fref $char8. filename $char256. filetype $char100. CCNUM 8. CCNUMX $char2. colname $char50. sub $char1. trm 1. year $char4. dbtype $char3.
			ext $char3.;
		rc = filename(fref,"&amp;amp;DIR");

		if rc = 0 then
			do;
				did = dopen(fref);
				rc = filename(fref);
			end;
		else
			do;
				length msg $200.;
				msg = sysmsg();
				put msg=;
				did = .;
			end;

		if did &amp;lt;= 0 then
			putlog 'ERR' 'OR: Unable to open directory.';
		dnum = dnum(did);
		call symput("dnum",dnum);
		fcount = 0;
		%PUT &amp;amp;DNUM;

		do j = 1 to dnum;
			filename = dread(did, j);
			putlog filename=;
			fid = mopen(did, filename);
			ext=upcase(scan(filename,-1,'.'));
			NUMDOTS = count(filename,'.');
			putlog numdots=;

			IF ext IN ('SAS', 'egp') THEN
				output tibco_list;
		end;

		rc = dclose(did);
	run;

%mend list_members;

%list_members;
RUN;

%macro readraw;

	%SETOBS(tibco_list);

	DATA tibco_list;
	SET tibco_list NOBS=NOBS;
	RETAIN SEQ;
	SEQ=SUM(SEQ,1);
	RUN;

	%let rc=%sysfunc(filename(fileref,%superq(dir)));
	%let did=%sysfunc(dopen(&amp;amp;fileref));

	%do dmem=1 %to &amp;amp;fnobs;

	   	DATA _NULL_;
		SET tibco_list;
		WHERE SEQ = &amp;amp;dmem;
		CALL SYMPUT("memname",trim(filename));
		RUN;

		*--this is telling the code that we are only interested in files that have an extension of SAS;
		%if %qupcase(%qscan(%superq(memname),-1,.))=&amp;amp;ext. %then
			%do;
				*--depending on the file type you are looking at, you may need another method to read in the file contents;
				data temp;
					length program $3600.;
					infile "&amp;amp;dir.\&amp;amp;memname." truncover;
					input @01 line $char2500.;
					line_num=_n_;
					program="&amp;amp;dir\&amp;amp;memname.";

					if index(upcase(line), "&amp;amp;STRING") &amp;gt; 0 then
						do;
							line_num=_n_;
							program="&amp;amp;dir\&amp;amp;memname.";
							output;
						end;
				run;

				proc append data=temp base=all;
				run;

			%end;
	%end;

	%let dsid = %sysfunc(open(all));

	*-- If the data set exists, then grab the number of observations and variables;
	*-- then close the data seth;
	%if &amp;amp;dsid %then
		%do;
			%let nobs =%sysfunc(attrn(&amp;amp;dsid,nobs));
			%let rc = %sysfunc(close(&amp;amp;dsid));
			%put &amp;amp;nobs;

			%if &amp;amp;nobs &amp;gt; 0 %then
				%do;
					proc print data=all noobs;
						title "Looking for  &amp;amp;string.";
						title2 " &amp;amp;string found in the following programs";
					run;
				%end;
			%else %put NOTE: &amp;amp;string not found in &amp;amp;dir.;
		%end;

	%let didc=%sysfunc(dclose(%nrbquote(&amp;amp;did)));
	%let rc=%sysfunc(filename(fileref));
%mend readraw;

%readraw;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Mar 2024 18:34:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Searching-a-string-in-various-directories/m-p/919984#M362346</guid>
      <dc:creator>Carl_1234</dc:creator>
      <dc:date>2024-03-12T18:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: Searching a string in various directories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Searching-a-string-in-various-directories/m-p/919996#M362354</link>
      <description>&lt;P&gt;For a head start, I have a ready-made macro (%findfiles) that can traverse directories and produce&amp;nbsp;either a list of files with a specified extension in the log&lt;BR /&gt;or write them to a SAS dataset.&lt;BR /&gt;SYNTAX: &lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;%FindFiles(dir,&amp;lt;ext,dsn,sub&amp;gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;dir=fully qualified directory path&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;ext=Space delimited list of file extensions (Optional, default is ALL)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;dsn=name of data set to store filenames (Optional, otherwise writes to log.)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;sub=look in subfolders? (Y|N default is Y)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Examples:&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;%FindFiles(c:\temp, csv)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;%FindFiles(\\server\folder\, xls xlsx xlsm, work.myfiles)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;%FindFiles(s:/workshop,sas,work.pgm_files,N)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;This macro depends on three utility macros (&amp;nbsp;%exist, %fileattribs, and %translate). You can download the files from my GitHub &lt;A href="https://github.com/SASJedi/sas-macros/tree/master" target="_self"&gt;sas-macros&lt;/A&gt; repository, or use this SAS code to download them:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path=&amp;lt;your custom macro storage location&amp;gt;;
filename maccode "&amp;amp;path/exists.sas";
proc http url="https://github.com/SASJedi/sas-macros/raw/master/exist.sas" out=maccode;
run;

filename maccode2 "&amp;amp;path/fileattribs.sas";
proc http url="https://github.com/SASJedi/sas-macros/raw/master/fileattribs.sas" out=maccode2;
run;

filename maccode3 "&amp;amp;path/translate.sas";
proc http url="https://github.com/SASJedi/sas-macros/raw/master/translate.sas" out=maccode3;
run;

filename maccode4 "&amp;amp;path/findfiles.sas";
proc http url="https://github.com/SASJedi/sas-macros/raw/master/findfiles.sas" out=maccode4;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Examine the files you downloaded to see how the code works and to ensure there's nothing nefarious going on there, if you wish.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* After examining the code you downloaded, run the macro programs to compile the macors */
%include maccode;
%include maccode2;
%include maccode3;
%include maccode4;

filename maccode clear;
filename maccode2 clear;
filename maccode3 clear;
filename maccode4 clear;

/*Get syntax help in the log for any macro using ? as the only parameter value:*/
%findfiles(?)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can then use the dataset you created to drive the rest of your process...&lt;/P&gt;
&lt;P&gt;For example, I ran this on my computer:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%FindFiles(D:/Courses/PG1V2, xls xlsx xlsm, work.myfiles)
proc print noobs; run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And this was the result:&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="left"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.MYFILES" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;Item&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;Path&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;Filename&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;Size&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;CRDate&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;CRTime&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;ModDate&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;ModTime&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="l data"&gt;D:/Courses/PG1V2/data&lt;/TD&gt;
&lt;TD class="l data"&gt;class.xlsx&lt;/TD&gt;
&lt;TD class="r data"&gt;10,000&lt;/TD&gt;
&lt;TD class="r data"&gt;06/12/2023&lt;/TD&gt;
&lt;TD class="r data"&gt;7:51:04&lt;/TD&gt;
&lt;TD class="r data"&gt;12/08/2017&lt;/TD&gt;
&lt;TD class="r data"&gt;12:13:00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;2&lt;/TD&gt;
&lt;TD class="l data"&gt;D:/Courses/PG1V2/data&lt;/TD&gt;
&lt;TD class="l data"&gt;eu_sport_trade.xlsx&lt;/TD&gt;
&lt;TD class="r data"&gt;234,100&lt;/TD&gt;
&lt;TD class="r data"&gt;06/12/2023&lt;/TD&gt;
&lt;TD class="r data"&gt;7:51:04&lt;/TD&gt;
&lt;TD class="r data"&gt;12/19/2017&lt;/TD&gt;
&lt;TD class="r data"&gt;14:48:36&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;3&lt;/TD&gt;
&lt;TD class="l data"&gt;D:/Courses/PG1V2/data&lt;/TD&gt;
&lt;TD class="l data"&gt;np_info.xlsx&lt;/TD&gt;
&lt;TD class="r data"&gt;7,234,320&lt;/TD&gt;
&lt;TD class="r data"&gt;06/12/2023&lt;/TD&gt;
&lt;TD class="r data"&gt;7:51:04&lt;/TD&gt;
&lt;TD class="r data"&gt;01/30/2018&lt;/TD&gt;
&lt;TD class="r data"&gt;13:26:40&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;TD class="l data"&gt;D:/Courses/PG1V2/data&lt;/TD&gt;
&lt;TD class="l data"&gt;storm.xlsx&lt;/TD&gt;
&lt;TD class="r data"&gt;6,859,276&lt;/TD&gt;
&lt;TD class="r data"&gt;06/12/2023&lt;/TD&gt;
&lt;TD class="r data"&gt;7:51:04&lt;/TD&gt;
&lt;TD class="r data"&gt;12/05/2019&lt;/TD&gt;
&lt;TD class="r data"&gt;12:51:42&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;Hope that helps.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 19:18:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Searching-a-string-in-various-directories/m-p/919996#M362354</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2024-03-12T19:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: Searching a string in various directories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Searching-a-string-in-various-directories/m-p/920016#M362363</link>
      <description>&lt;P&gt;Which operating system?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DOS (and WIndows still supports Dos commands) FINDSTR&lt;/P&gt;
&lt;P&gt;UNIX and derivative operating systems the GREP command does this &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would start with OS commands instead of writing from scratch as many of those are already set up to do directory and subdirectory searches.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 20:19:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Searching-a-string-in-various-directories/m-p/920016#M362363</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-03-12T20:19:29Z</dc:date>
    </item>
  </channel>
</rss>

