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

7

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."

Share

About Author

Rick Wicklin

Distinguished Researcher in Computational Statistics

Rick Wicklin, PhD, is a distinguished researcher in computational statistics at SAS and is a principal developer of PROC IML and SAS/IML Studio. His areas of expertise include computational statistics, simulation, statistical graphics, and modern methods in statistical data analysis. Rick is author of the books Statistical Programming with SAS/IML Software and Simulating Data with SAS.

7 Comments

  1. This is very cool!

    OK, it doesn't add to my knowledge of statistics or IML or any of the great topics you cover, but it DOES make the SAS documentation a lot more useful.

  2. Hi Rick
    This is a really nice feature!

    While you're at it, how about some more documentation on the data sets and catalogs in sashelp?

    PROC Contents data = sashelp._all_;

    I note that most of the data sets do not have labels.
    Just fixing that would be a Great Help!

    Ron Fehd sashelp.class maven

  3. Hi Rick,

    I just have a quick question which has nothing to do with this article (Sorry, not sure where I can ask a question on this website).

    Is there a function in IML that can do the square root of a matrix, say A*A=B and B is known. how can I get the value of matrix A??

    Have checked on line but didn't find any results

    Thanks

  4. This is great news. Every day I use SAS and R, and each has its strengths. This announcement brings SAS in this regard closer to R, which packages sample data with procedures making it easy to learn a procedure.

Leave A Reply

Back to Top