BookmarkSubscribeRSS Feed
iSAS
Quartz | Level 8

Hello,

 

Please refer on the data steps below:

 

data have;
length;
infile datalines delimiter='|'  dsd truncover;
input job_id return_cd1 Trigger $ Prerequisite $;
datalines;
2|0|Exec|
11|1|Exec|
7|.|Not Exec|11,2
;
run;

data Job_Sch_Merge;
set have;
array statuses(1000) _temporary_;
length pending_job $100;
statuses(job_id) = return_cd1;
if find(Trigger,'Not Exec','i') and Prerequisite ne '' then do; /*This will list down pending pre-requisite jobs in pending_job column*/
do _n_ = 1 to countw(Prerequisite);
_job = scan(Prerequisite,_n_);
if statuses(_job) ne 0 then
pending_job = compress(catx(',',pending_job,_job),,'s');
end;
end;
drop _job /*return_cd1*/;
run;

 

data step Job_Sch_Merge will work fine as long as the Prerequisite of a job_id is above it (see above work.have).

 

However, if work.have is like the dataset below, it will have an issue. May i know how to fix data step Job_Sch_Merge? Thank you in advanced.

 

data have;
length;
infile datalines delimiter='|'  dsd truncover;
input job_id return_cd1 Trigger $ Prerequisite $;
datalines;
2|0|Exec|
7|.|Not Exec|11
11|0|Exec|
;
run;

 

1 REPLY 1
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
  • 1 reply
  • 694 views
  • 1 like
  • 2 in conversation