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
Quartz | Level 8

Thanks Everyone, solution provided helped. 🙂 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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