Heping hands, I need few helps here. From below three records , I need to extract *.sas and .log file as for example , 1st record "G:\DATA\QDF\PGMS\05_Master.sas" and "G:\Data\QDF\PGMS\Log\05_Master_221011.log", same for other records.
Can you please suggest.
data have;
input @1 old_prog $150.;
datalines;
I,Job started. cmd=[D:\Progs\SASexec.pl --sysin G:\DATA\QDF\PGMS\05_Master.sas --log G:\Data\QDF\PGMS\Log\05_Master_221011.log
I,Job started. cmd=[D:\Progs\SASexec.pl --config en --sysin G:\Data\QMO\PGMS\General\Prepare_Technical_Gofiles.sas --option "-sysparm '${UACBATCHRUN}${FREQ} prod '" --log G:\Data\QMO\OUTPUT\Log\Prepare_Technical_Gofiles_20221011_000631.log ], pid=1748
I,Job started. cmd=[D:\Progs\SASexec.pl --sysin G:\SAS_GLOBALS\Global_Startup\MainProg_new.sas --config en --log G:\data\QZ3\OUTPUT\QZ3003\log\QZ3003_221011_001434.log --print G:\DATA\QZ3\OUTPUT\QZ3003\LOG\QZ3003_221011_001434.lst --option "-sysparm PQZ3
;
run;
data want;
length sas log $32767;
set have;
sas=prxchange('s/.*\s(\w:.*?\.sas)\s.*/$1/',-1,old_prog);
log=prxchange('s/.*\s(\w:.*?\.log)\s.*/$1/',-1,old_prog);
if sas eq old_prog then sas='';
if log eq old_prog then log='';
run;
- Cheers -
data have;
infile cards truncover;
input old_prog $500.;
datalines;
I,Job started. cmd=[D:\Progs\SASexec.pl --sysin G:\DATA\QDF\PGMS\05_Master.sas --log G:\Data\QDF\PGMS\Log\05_Master_221011.log
I,Job started. cmd=[D:\Progs\SASexec.pl --config en --sysin G:\Data\QMO\PGMS\General\Prepare_Technical_Gofiles.sas --option "-sysparm '${UACBATCHRUN}${FREQ} prod '" --log G:\Data\QMO\OUTPUT\Log\Prepare_Technical_Gofiles_20221011_000631.log ], pid=1748
I,Job started. cmd=[D:\Progs\SASexec.pl --sysin G:\SAS_GLOBALS\Global_Startup\MainProg_new.sas --config en --log G:\data\QZ3\OUTPUT\QZ3003\log\QZ3003_221011_001434.log --print G:\DATA\QZ3\OUTPUT\QZ3003\LOG\QZ3003_221011_001434.lst --option "-sysparm PQZ3
;
data want;
set have;
sas_file=scan(substr(old_prog,findw(old_prog,'--sysin')+7),1,'-],');
sas_log=scan(substr(old_prog,findw(old_prog,'--log')+5),1,'-],');
run;
data want;
length sas log $32767;
set have;
sas=prxchange('s/.*\s(\w:.*?\.sas)\s.*/$1/',-1,old_prog);
log=prxchange('s/.*\s(\w:.*?\.log)\s.*/$1/',-1,old_prog);
if sas eq old_prog then sas='';
if log eq old_prog then log='';
run;
- Cheers -
Thanks Everyone, solution provided helped. 🙂
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.