BookmarkSubscribeRSS Feed
TGarcia
Calcite | Level 5

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

3 REPLIES 3
art297
Opal | Level 21

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;

TGarcia
Calcite | Level 5

It is one space between jobid and description, but the big idea is to have only RUN# from description.

art297
Opal | Level 21

Then did you try the code I suggested?  I think it does exactly what you want.

sas-innovate-2024.png

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.

 

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.

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
  • 473 views
  • 0 likes
  • 2 in conversation