How to access any program or data set that appears in the SAS/STAT documentation

February 13, 2013
By

(This article was originally published at The DO Loop, and syndicated at StatsBlogs.)

If you are like me, you've experienced the following frustration. You are reading the SAS/STAT documentation, trying to understand some procedure or option, when you find an example that is very similar to what you need. "Great," you think, "this example will help me understand how the SAS procedure works!" And then you see it. Instead of a complete DATA step that you can cut and paste into SAS, the example shows only the first few observations, followed by

   ... more lines ...

Argh! The example is using a large data set, and not all observations are shown! If you have not experienced this situation, here's a link to an example from the SAS/STAT documentation that uses the "... more lines ..." trick.

I've always found this situation annoying. As I wrote in a previous article, you can access all sample programs from within the SAS Windowing Environment, but I've always wished that the sample data were available online.

Sample libraries are now available online

My wish is granted! All of the sample programs and data for the SAS/STAT products are now online. The samples for the SAS/ETS product are likewise available, and the recent issue of SAS Statistics and Operations Research News says that "the samples for other products [will be] available soon." Awesome news!

Access sample data directly from the Web

In addition, Warren Kuhfeld wrote some DATA step code that shows how you can use SAS to read the data and program directly from the Web site. This is especially useful for posting questions on a SAS discussion forum or sending an example by email.

If you follow the link, there are several examples of how to read the entire sample, or just read the data. The last example shows how to "extract the initial comment block, title, and DATA step and submit them to SAS." If you like the idea of reading data directly from the Web, Chris Hemedinger recently showed how to read data from a public URL by using PROC HTTP.

So next time you want to run a SAS example and the documentation includes the dreaded statement "... more lines ...", don't fret. The samples are now available online. And you don't even have to bookmark a special URL. Just go to the main page for the 12.1 documentation and click on the link that says "Example Programs."

tags: Getting Started, Tips and Techniques



Please comment on the article here: The DO Loop

Tags: , ,


Subscribe

Email:

  Subscribe