BookmarkSubscribeRSS Feed
kalbo
Obsidian | Level 7

Hi, I have a question.

 

In my SAS log, I there are many occurrences of the following text which is split over 2 lines for example.

NOTE: The above message was for the following BY group:
Unique Subject Identifier=ABCD-123-4567-ABC0001-027 DAGRPID=DA

 

This text is "buried" in other varying text, example below:

 

ERROR: The ID value "XITDISP" occurs twice in the same BY group.
NOTE: The above message was for the following BY group:
Unique Subject Identifier=ABCD-123-4567-ABC0001-027 DAGRPID=DA
ERROR: The ID value "XITDISP" occurs twice in the same BY group.
ERROR: The ID value "XITDISP" occurs twice in the same BY group.
ERROR: The ID value "XITDISP" occurs twice in the same BY group.

 

I want to read in only the 2 lines I mention at the top of my post and store all of those in a data set. There are many occurrences of these 2 lines throughout my log file and the text above and below varies.

 

Any help would be apreciated.

 

Thanks.

1 REPLY 1
Reeza
Super User
Why? Perhaps query the data set directly to find those cases instead?

If you're looking for generic log parsers, try searching lexjansen.com for many written examples.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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