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."
7 Comments
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.
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
Hi Ron. These are good ideas, and I'm pleased to announce that we will be posting documentation about the Sashelp data sets and catalogs in the near future.
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
SAS has many discussion forums where you can ask questions about how to compute various quantities in SAS. The SAS/IML forum is for questions about how to compute quantities in the SAS/IML language.
In this case, the function you want is the ROOT function (assuming B is symmetric), which you can read about at http://blogs.sas.com/content/iml/2012/02/08/use-the-cholesky-transformation-to-correlate-and-uncorrelate-variables/
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.
Just to be clear: SAS has distributed the data for years. This just makes the data easier to locate.