BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.

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;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Oligolas
Barite | Level 11
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 -

View solution in original post

3 REPLIES 3
Ksharp
Super User
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;
Oligolas
Barite | Level 11
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 -

kumarsandip975
Pyrite | Level 9

Thanks Everyone, solution provided helped. 🙂 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 837 views
  • 2 likes
  • 3 in conversation