Connect Banner
for layout only

Search This Site

for layout only
for layout only

Link to Current Issue
Link to Archives
Link to About Connect Page
for layout only
  for layout only
for layout only Category: Social Sciences, Statistics and Mapping

Data Management in SAS/FSP

By Ying-Hua Liu


The SAS statistical program offers many supplemental tools, such as SAS/AF and SAS/SQL, that are very useful to intermediate and advanced programmers. Another such product is SAS/FSP (Full Screen Products), an advanced SAS tool used to interactively update and maintain databases. Procedures in SAS/FSP are developed by the Display Products Division. The product allows researchers to create "views in SAS that are operating system-independent. Product development features include design, programming, debugging, support, and preliminary documentation.

Using SAS/FSP software you can:

  • browse and edit the contents of SAS data sets;
  • enter data into existing SAS data sets;
  • create new SAS data sets;
  • browse and edit SAS data views created with SAS/ACCESS;
  • browse SAS data views created with the SQL procedure in Base SAS software;
  • create, edit, and print form letters and reports;
  • build and customize end-user applications.[1]

 Figure 1. A sample data set viewed in SAS/FSP's full screen mode.
Figure 1. A sample data set viewed in SAS/FSP's full screen mode.
 

SAS/FSP'S Main Procedures

The four main procedures in SAS/ FSP are: fsbrowse, fsedit, fsview, and fsletter.

First, in order to view a full screen, you must create a new folder in the C:\ drive of your computer and give it a name (e.g., "London). If you forget to create this new location and then refer to it in your code (as described below), all of your work will be put into the SAS/FSP temporary work library, which will be deleted when you close your session.

In SAS/FSP, enter the following statement:[2]

libname librif "C:\London;
run;
proc append base=librif.company
data=sashelp.company;
run;
(This appends a copy of the file company within sashelp to your library librif.)

proc contents data =librif.
company;
run ;

(This displays how many variables there are in company, their types, and any observations in the data.)

Figure 2. Cases can be browsed in the View menu.
Figure 2. Cases can be browsed in
the View menu.

 

Fsbrowse

The fsbrowse procedure provides a custom display in which you can specify how your data are presented and add descriptive text, if you wish. Fsbrowse allows you to browse the contents of a SAS data set one observation at a time.

proc fsbrowse data=librif.
company;
run;

You will now see a full screen, as shown in figure 1. In full screen mode, you can browse each case from the View pull-down menu (see figure 2). More important, you can also find a case using the Search menu. To do so, type the variable, then enter the value or character in which you are interested. For example, if you want to find level5=Steffen Graff, enter level5 as the variable name, then enter "Steffen Graff as the value; since level5 is a string, you should include quotation marks around "Steffen Graff."

Fsedit

The fsedit procedure lets you update the database by editing, deleting, or adding a new observation. To use fsedit, go to the Edit menu and select Update, or write the following fsedit statement. (Be sure to close the fsbrowse window first.)

proc fsedit data=librif.
company;
run;

To edit and delete an observation, first find the observation using the Search menu, then go to the observation. From there, you can change the value for each observation or add and delete values or cases by going to the Edit menu and selecting "Add Record" or "Delete Record."

 Figure 3. A sample data set as it appears in fsview ( fictitious data is used here).
Figure 3. A sample data set as it appears
in fsview (fictitious data is used here).

 

Fsview

Fsview enables you to browse or edit a SAS data set, displaying it as a table of rows and columns. You can use this procedure to create a new SAS data set. Fsview also provides tools for customizing an fsview application. For example, you can redesign the display by changing the size, position, and colors of the fsview window. In addition, you can add computed variables, which display values that are calculated from other variables in the data set.

For fsview, enter:

proc fsview data=librif.
company;
run;

The output will be similar to the sample shown in figure 3.

Fsletter

The fsletter procedure enables you to create, edit, and print letters and other documents. When creating and editing documents in the fsletter window, you can use all the features of the SAS text editor, including the spell checker.

Keep in mind that your fsletter documents can include named fields. When the document is printed, you can fill in these fields manually, or the procedure can fill in the fields automatically using values from a SAS data set. This is convenient for creating and maintaining form letters, for example. You can print individual copies of the document, or you can automatically print a copy for every observation in a data set. For more information about fsletter, visit http://support.sas.com/91doc/docMainpage.jsp.

Data Selection and Data Merge

Say that you have finished your data entry, and now you want to separate your data into subsets and then examine a single subset. For instance, you might only want information about New York, Tokyo, or London. You can get each data subset using the "where statement:

Data librif.Company;
Set librif.company;
Where level2=Company;
run;

Data librif.Newyork;
Set librif.company;
Where level2=New York;
run;

Data librif.London;
Set librif.company;
Where level2=London;
run;

data librif.Tokyo;
Set librif.company;
Where level2=Tokyo;
run;

Using the "Explorer window, you will be able to see the four data sets you have created. You may now work on all four data sets at once (see figure 4).

Figure 4. Our sample data sets.
Figure 4. Our sample data sets.
 

Overview

SAS/FSP is a powerful tool for managing databases. Clinical and business research projects with anticipated long periods of data input and management could benefit from this tool. All computers in the ITS computer labs (Macintosh and Windows) offer SPSS software, and all Windows computers in all of the labs offer SAS. If you have any comments and questions about this software, attend one of ITS' free workshops (http://www.nyu.edu/its/classes/) or contact Frank LoPresti at frank.lopresti@nyu.edu.

To receive email notices about statistical package training and clinics, join the "Statistics Forum found in the Forums channel in the Home tab of NYUHome (http://home.nyu.edu).

Footnotes


1. http://support.sas.com/onlinedoc/913/docMainpage.jsp
2. Librif is the SAS library name. Replace "C:\London with the name of your new folder, e.g., "C:\YourFolderName.

 

SAS vs. SPSS: A Student's Perspective

When learning to do research using statistical software packages, many students choose to work either with SPSS or SAS, and are interested in exploring the differences between the two programs. Both packages have advanced tools and powerful data management products, but as you might imagine, each package has its own unique style and its own strengths and weaknesses.

SPSS is one of the most popular statistical packages. It has a very fast learning curve, due in part to its user friendly pull-down menus. SAS, on the other hand, requires the use of at least some written commands, making it more difficult for beginners to use. But SPSS also offers a written command language (a "syntax" language) that students can learn by "pasting" the syntax from the package's point-and-click menus into a file. The ability to write and store programs makes both packages important research tools.

SPSS has some very interesting data management tools. For instance, it has commands for reshaping data files from "wide" format to "long" format—i.e., making rows into columns. SPSS also allows you to work with many files if they are tables in a database.* SPSS boasts a friendly data editor that allows you to define the data set's variables (names, types, etc.) and enter your data into a display that resembles Excel. Saving an SPSS data set is similar to saving a Word document. But even with these advanced features, if you intend to be a power user, you will likely outgrow SPSS over time. Many researchers eventually move to other packages, such as SAS.

SAS is a powerful package and, accordingly, is more difficult to learn than SPSS. For the beginner, one of the most common problems is the complexity of defining, using, and saving data sets. Even professional programmers can make mistakes when creating a SAS data set. SAS is mired in old concepts, such as libraries, so beginners are often uncertain whether they have really saved their data. Almost all data management and analyses in SAS are done by writing programs. When beginners make a mistake in writing their SAS programs, it is hard for them to see where the error occurred or how to correct it. All these difficulties can be overcome with practice, but many students intend to do only a single analysis required for their degree. When this is the case, SAS is perhaps not the program best suited for a student's needs. If you need help deciding between SAS and SPSS, or information about classes and other resources that can help you learn these programs, contact Frank LoPresti at frank.lopresti@nyu.edu.


* See http://www.nyu.edu/its/pubs/connect/archives/spring02/lopresti.html, "A Quick Look at SPSS Version 11," by Frank Lopresti.

Author Biography

Ying-Hua Liu is a graduate student at NYU's Robert F. Wagner Graduate School of Public Service and works as a statistician assistant for ITS Faculty Technology Services.


Page last reviewed: November 7, 2005. All content ©New York University.
Questions or comments about this site? Send e-mail to: its.connect@nyu.edu.