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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1 reply
  • 954 views
  • 0 likes
  • 2 in conversation