Search engine using SAS

3

“It’s the age of the search engine! I remember people ‘Yahoo!’ing during the late 90's and ‘Google’ing till the late 2k's and now ‘Bing’ing. I just wondered, ‘Why not SAS?’” wrote Pramod. R on his blog SASopedia. This was the beginning of a quest and a MidWest SAS Users Groups 2012 paper.

Pramod. R, from the Target Corporation in Minneapolis, began learning SAS six years ago and initially worked a lot on reporting data – “pulling up the report in Excel, PDF, RTF or things like that.” According to Pramod. R, his work was difficult and time consuming until he learned of stored process. Now he can create a stored process and send it out to users, so that they can change the parameters and variables. Pramod. R says this brings in a new way of reporting for him.

"There was another feature in SAS, which I discovered and have been using more often that came out in SAS 9.2,” he said. “With the two new procedures that were introduced in SAS 9.2 – PROC HTTP and PROC SOAP, we can really interact with the web with in a much more integrated way and with more parameters.”

Parmod. R used both of his new-found SAS features and the Google Custom Search API to create a Search Engine in SAS.

The Google Custom Search API enables you to search the web, retrieve the results of the custom search and embed them in the desired format.

You need to create a key to use the API in SAS, and of course Pramod. R includes all of the instructions for that in his paper. The code and instructions for creating the custom search engine are in Pramod. R’s paper, “Search Engine Using SAS®.”

The output is originally delivered in XML format, but it is read into a data set using the index function. “This step does a bit of data cleaning, and then constructs an HTML page using SAS,” says Pramod. R.

The HTML page is a beautiful presentation of hyperlinked titles from Google. Why use this since it is still using the Google search engine? “We have a lot of information on the Web, for instance the stock market data or the scores of the Twin Cities games. We may want to do an analysis on that, but there wouldn’t be an option to export that data directly from Google.”

Download Pramod. R’s paper and all of the MWSUG 2012 papers, now.

Share

About Author

Waynette Tubbs

Editor, Marketing Editorial

+Waynette Tubbs is the Editor of the Risk Management Knowledge Exchange at SAS, Managing Editor of sascom Magazine and Editor of the SAS Tech Report. Tubbs has developed a comprehensive portfolio of strategic business and marketing communications during her career spanning 15 years of magazine, marketing and agency work.

3 Comments

  1. Pramod has a nice blog indeed. I tried to run his program which uses the "sound" function on my SAS Enterprise Guide 5.1 running on SAS 9.3. I got "ERROR: Undeclared array referenced: sound.". I wonder if this function still exists in SAS 9.3

    • Chris Hemedinger
      Chris Hemedinger on

      Divyesh, there is a CALL SOUND routine, but not an official "SOUND" function. I'm not sure when Pramod developed that example, but the SAS DATA step won't run it today. Here's a corrected version:

      data _null_;
      do j=1 to 20;
         do i=1 to 4;
            call sound(550,500);
         end;
         rc=sleep(1000);
      end;
      run;

      But CALL SOUND won't work well from SAS Enterprise Guide, since it's the SAS session that generates the sound, and that session could be on a remote machine. Here's a tip for generating sounds within your EG session, but you'll hear it only if you're within earshot of the machine where SAS is running.

  2. DEBIDATTA PANDA on

    I am not able to get the BOSS API key. As, it shows in Yahoo developer's page that the BOSS has been stopped since March, 2016. They are suggesting to use YPA. Can you please guide me how to get the key so as to run the job.

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to Top