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

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—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
  • 1 reply
  • 737 views
  • 1 like
  • 2 in conversation