I am trying to report on this data that is not consistent ( My key from Description should be #RUN)
example:
ID JOB DESCRIPTION
12301 ABC100 JOB RUN SUCCESS RUN# R12310
12302 ABC101 JOB DID NOT RAN
DO TO FAILURE RUN# R12311
12303 ABC102 JOB RUN SUCCESS RUN# R12312
12304 ABC103 JOB DID DID NOT RUN BECAUSE
CONDITION DID NOT SATISFY
IN RUN# R12313
12305 ABC104 JOB DID NOT RAN
DO TO FAILURE RUN# R12314
REPORT
ID JOB RUN_ID
12301 ABC100 R12310
12302 ABC101 R12311
12303 ABC102 R12312
12304 ABC103 R12313
12305 ABC105 R12314
You are going to have to do more work if you also need description as there is only one space between the description and the jobid. However, if you don't need the description, you can get away with:
data want;
informat job $6. run_id $6.;
input ID JOB @"RUN#" run_id;
cards;
12301 ABC100 JOB RUN SUCCESS RUN# R12310
12302 ABC101 JOB DID NOT RAN
DO TO FAILURE RUN# R12311
12303 ABC102 JOB RUN SUCCESS RUN# R12312
12304 ABC103 JOB DID DID NOT RUN BECAUSE
CONDITION DID NOT SATISFY
IN RUN# R12313
12305 ABC104 JOB DID NOT RAN
DO TO FAILURE RUN# R12314
;
proc print data=want;
var ID JOB run_id;
run;
It is one space between jobid and description, but the big idea is to have only RUN# from description.
Then did you try the code I suggested? I think it does exactly what you want.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.