BookmarkSubscribeRSS Feed
sonikm24
Calcite | Level 5

Hello,

           I have using a web crawler to find multiple instances of keywords (in the code I am searching for "Notional") from sec files (see the code attached). I am using the prxnext function to do the job. But I am having a problem when I am trying to output lines surrounding the keywords. I am trying to increase the output lines for every instance of the keyword in the sec file. E.g. if there are 5 instances of "Notional" in the sec file, i am trying to output lines surrounding each one of the instances of the keyword (see the attached sas code)

But this code is not able to increase or decrease the output lines surrounding the keywords even by changing 10 to 15 or 5. Can anyone help with the issue? I have attached the code and a sample excel file.

Thanks.

Sonik Mandal

1 REPLY 1
mfab
Quartz | Level 8

Hello @sonikm24,

 

could you please provide an example that is describing the problem?

Your excel-file seems to contain no information and your dataset 'sonik' is missing. It would be best, if you could provide some sample dataset, so that we can work on the problem without having to crawl the websites.

 

From what I understand, you want to output certain rows of a dataset.

For instance row 50, because some condition applies and then you also want row 49 and row 51, because they surround row 50?!

 

There are a number of ways, you could achieve that. Possibly a retain statement (with optional by-processing) could do the trick.

Another option would be to use a hash and hash-iterator.

 

Cheers,

Michael

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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