Free tool reads, converts SAS data
By Jeff Porter, IRE and NICAR
SAS, the expensive statistical software used widely in government and academic circles, might be out of reach of many newsroom budgets. But there's still a way - for free, no less - to read SAS data files and translate them into a format your spreadsheet or database manager can use.
From the company's Web site, you can download the SAS System Viewer at no cost. To find it, go to http://support.sas.com and click on the link to the left called "Software Downloads." That takes you to a page of downloads, categorized by product type. Click on the link called "Base SAS Software." You should see a short list of items available for download, including the SAS System Viewer. Click away, and follow the screen instructions. You'll have to create a login, including your e-mail address.
Installation should be a snap. Download the executable file and just double-click on it to start the installation.
After the program installs, it's time for some practice. Go to the Web page v.usda.gov/cnpp healthyeating.html There you can download data on the USDA Healthy Eating Index, a summary measure of overall diet quality. It provides a picture of the type and quantity of food people eat and the degree to which diets comply with specific recommendations in the Dietary Guidelines and the Food Guide Pyramid.
Choose to download the 1999-2000 Healthy Eating Index data in compressed, self-extracting SAS 6.12 format. Also download the 1999-2000 Food Guide Pyramid Servings database. The files are relational, creating a summary of food intake by respondent.
This will not be the most exciting database you've ever worked with. It does, however, give you some practice in using SAS System Viewer.
You'll need to extract two files: hei9900.sd2 and pyraserv9900.sd2. Start the SAS System Viewer, then go to File > Open. Keep the default setting under Files of Type as All SAS Datasets, then navigate to the appropriate folder and open the hei9900.sd2 file. It should look something like Figure 1.
Now, let's check out a few features of SAS System Viewer. First, notice that the column headers are somewhat cryptic. So go to the View menu item and choose Headers and Names. Now, you'll see something a little nicer-looking in Figure 2. Prefer just the shorter version? Toggle back to headers.
You can also view the variables, too, under the same View menu, and you'll see a list of all the variables (also known as columns) in the SAS dataset. To go back to viewing the data, just go back to the View menu and choose Formatted.
Now, some final few steps to make the data useful in different formats. Choose how you prefer to view the data - with headers or the lengthier names. Typically, if I'm going to use a file in Microsoft Excel, I like longer names. If I'm going to throw something into a database manager, shorter field names are my preference. So consider how you're going to use your SAS file, then simply go to File > Save As and choose your File of Type.
Now, you've saved the file as a text file of your choice, ready to be opened in a spreadsheet or database manager.
Of course, the viewer doesn't offer many of the features of the full-blown version SAS. You can download, review, even edit SAS program files with the extension .sas, but you can't run those programs with the viewer alone. There's a long list of SAS-type files you can just open in read-only mode, including the data files such as .sd2.
Of course, you can then save those as text, reopen them with different software then edit data tables. Text files opened with the SAS viewer - such as .CSV, txt, prn, .dat - can be edited, although there are better applications for that.
SAS isn't the most common data type that government agencies post on their Web sites, so you probably won't use the SAS System Viewer every day. Even government agencies that process data with SAS have the ability to provide the data in almost any way you request - text, Excel, Access, dBASE so theoretically, all you have to do is call or e-mail with a request and they'll send it right out to you.
But if you're on deadline, sometimes you don't have that luxury of time, so you can at least view and convert SAS data files with a free addition to your CAR toolbox.
Contact Jeff Porter by e-mail at jeff@nicar.org