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.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.