SAS Programming

DATA Step, Macro, Functions and more
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-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1193 views
  • 0 likes
  • 2 in conversation