Hello all,
can someone help me to create a loop logic .
my requirement: i want to search a list of table names in list of sas programs in a file.
i have 400 table names and i have 4000 sas programs.
here is the code for for searching one single table in all the sas programs.
%LET NAME = "MRC_ORDER_SCHEDULE_PK";
*************************************************************************************************************************************;
FILENAME INP "/sasdata/mpn_sas/programs/prd/oracle/tdmh2k/*.sas";
DATA TDMH2K;
;
LENGTH _filepath FILEPATH1 $550;
INFILE INP FILENAME = _filepath LRECL=80 PAD END = DONE ;
DO WHILE(NOT DONE);
INPUT REC $CHAR80.;
filepath1 = STRIP(_filepath);
RECNO+1;
IF INDEX(UPCASE(REC),&NAME) THEN OUTPUT;
END;
RUN;
and here is the below code what i tried to do:
FILENAME INP "/sasdata/mpn_sas/programs/prd/oracle/tdmh2k/*.sas";
%macro test(NAME);
DATA TDMH2K_TEMP;
;
LENGTH _filepath FILEPATH1 $550;
INFILE INP FILENAME = _filepath LRECL=80 PAD END = DONE ;
DO WHILE(NOT DONE);
INPUT REC $CHAR80.;
filepath1 = STRIP(_filepath);
RECNO+1;
IF INDEX(UPCASE(REC),&NAME) THEN OUTPUT;
END;
RUN;
PROC APPEND BASE=TDMH2K DATA=TDMH2K_TEMP FORCE;
RUN;
%mend;
DATA _NULL_;
SET TEST ;
DO i=1 TO 5;
IF s_no=i then do;
CALL SYMPUTX('NAME',trim(table_name));
end;
end;
%TEST(&NAME);
run;
Can someone help .
here is the attached output am getting. but i need the output with records. for one single table am able to get the output but when i try using loop .0 records.
Hello @Shanthi123 !
I wrote this code for analyzing my crypto mining logs and it could be modified to do what you are asking with some changes... 🙂
Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF
View now: on-demand content for SAS users
Hello @Shanthi123 !
I wrote this code for analyzing my crypto mining logs and it could be modified to do what you are asking with some changes... 🙂
Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF
View now: on-demand content for SAS users
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.