I have 4 SAS log files that produce the followings,
Log 1 produces,
rc = 0 after rm of enrollfee_notif0102.sas7bdat
rc = 0 after rm of mailing_notif0102.sas7bdat
rc = 0 after rm of pnt_notif0102.sas7bdat
Successful run of TMARPT_NOTIF01.sas at Thu Feb 28 02:10:02 EST 2019 RC=0
Log 2 produces,
rc = 0 after rm of notif02_file
rc = 0 after rm of enrollfee_notif0102.sas7bdat
rc = 0 after rm of mailing_notif0102.sas7bdat
rc = 0 after rm of pnt_notif0102.sas7bdat
Successful run of TMARPT_NOTIF02.sas at Thu Feb 28 02:15:02 EST 2019 RC=0
log3 produces,
Successful run of TMARPT_NOTIF05.sas at Thu Feb 21 02:40:02 EST 2019 RC=0
chmod: cannot access `/saswork/output/tma/report_output/NOTIF05-????-20190220.PIP': No such file or directory
NOTIF05 Report Terminated at Thu Feb 21 02:40:02 EST 2019
Trying to chmod 775 /saswork/output/tma/report_output/NOTIF05-????-20190220.PIP
Return Code: 1
log4 produces,
Successful run of TMARPT_NOTIF06.sas at Thu Feb 21 02:45:02 EST 2019 RC=0
switching directory to /saswork/output/tma/pnt/archive
making directory p20190220
chmod 755 p20190220
moving /saswork/output/tma/pnt/archive/PNT.* to /saswork/output/tma/pnt/archive/p20190220
mv: cannot stat `/saswork/output/tma/pnt/archive/PNT.*': No such file or directory
chmod: cannot access `/saswork/output/tma/report_output/NOTIF06-????-20190220.PDF': No such file or directory
NOTIF06 Report Terminated at Thu Feb 21 02:45:02 EST 2019
Trying to chmod 775 /saswork/output/tma/report_output/NOTIF06-????-20190220.PDF
Return Code: 1
I need to read these log files into SAS and produce a .txt file from them. How can I accomplish this task.
Do you need to parse any of the text or do you just need to create a new text file by concatenating the 3 log files?
Textfiles are read with a data-step using infile and input statements. See the documentation of both statements for examples. The infile-statement allows wildcards, so you can read all files with one step. If you want to create a text-file you use file and put statements.
I can't give you code, because you forgot to explain how the output should look.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.