Chapter Contents

Previous

Next
SAS/FSP Software Procedures Guide

Creating New SAS Data Sets

You can use the FSVIEW procedure to create new SAS data sets. You name the variables and specify their attributes in the FSVIEW NEW window. After you exit the FSVIEW NEW window, the data set is created. It contains one observation, which is filled with missing values. An FSVIEW window is then automatically opened for editing so that you can enter values in the new data set.


Opening the FSVIEW NEW Window

You can open the FSVIEW NEW window in two ways:


Using the NEW= Option

When you invoke the FSVIEW procedure with the NEW= option rather than with the DATA= option in the PROC FSVIEW statement, the FSVIEW NEW window is opened when the FSVIEW procedure is initiated.

For example, the following statements initiate an FSVIEW session and open the FSVIEW NEW window to create the new data set MASTER.QTR1REV:

proc fsview new=master.qtr1rev;
run;

The FSVIEW NEW Window shows the initial FSVIEW NEW window display.

The FSVIEW NEW Window

[IMAGE]

You define the variables in the fields provided. When you issue the END command, the data set is created, and the FSVIEW window is automatically opened for editing so that you can add observations and enter variable values.

Note:   After you issue the END command to close the FSVIEW NEW window, you cannot return to that window to make changes to information in the data set.  [cautionend]


Using the NEW Command

You can issue the NEW command from an FSVIEW window to define a new data set within an FSVIEW session.

For example, the following command opens the FSVIEW NEW window to define the data set MASTER.QTR1REV:

new master.qtr1rev

The display in this case is the same as shown in Display 21.2. However, when you use the END command to close the FSVIEW NEW window and create the new data set, an additional FSVIEW window is opened. You can use that window to add observations and enter values for the new data set. The new FSVIEW window may overlay the window from which the NEW command was issued.


Creating a Data Set That Is Like an Existing One

If you want to create a new SAS data set that is identical or similar in structure to an existing data set, you can save time by letting the SAS System do some of the work. Instead of entering all the variable information, use the LIKE= option to identify an existing SAS data set. When the FSVIEW NEW window is opened, the variable names and attributes of the data set that you specified in the LIKE= option are automatically displayed.

The display contains all the information necessary to create a SAS data set that has exactly the same structure as the specified data set. (Only the structure of the specified data set is copied, not the contents.) You have the option of making changes to the variable names and attributes before creating the new data set. You can also delete a variable entirely by blanking out its name.

You open the FSVIEW NEW window in one of two ways: either with the NEW= option when you invoke the FSVIEW procedure or with the NEW command when you open an additional FSVIEW window. You can use the LIKE= option with both of these methods.

In the PROC FSVIEW statement, the LIKE= option must always be used in conjunction with the NEW= option. For example, the following statements initiate an FSVIEW session, open the FSVIEW NEW window to create the data set MASTER.QTR2REV, and fill in the fields of the FSVIEW NEW window with the names and attributes of the variables in the data set MASTER.QTR1REV:

proc fsview new=master.qtr2rev
     like=master.qtr1rev;
run;

The following command performs the same tasks, but from within an active FSVIEW session:

new master.qtr2rev like=master.qtr1rev


Closing the FSVIEW NEW Window

To close the FSVIEW NEW window, create the SAS data set, and open the FSVIEW window so that you can enter values for each observation, issue the END command. To close the FSVIEW NEW window without creating a data set, issue the CANCEL command.


FSVIEW NEW Window Commands

In addition to the global commands that are discussed in SAS/FSP Software Global Commands, you can use the following commands in the FSVIEW NEW window to scroll information, to duplicate selected lines, or to exit with the choice of creating a data set or canceling it.
Scrolling

BACKWARD <HALF | PAGE | n>
BOTTOM
FORWARD <HALF | PAGE | n>
LEFT
RIGHT
TOP

Exiting

CANCEL
END


Command Descriptions

Here are descriptions of the FSVIEW NEW window commands:

BACKWARD <n | HALF | PAGE>
scrolls vertically toward the top of the window. The following scroll amounts can be specified:
n scrolls upward by the specified number of lines.
HALF scrolls upward by half the number of lines in the window.
PAGE scrolls upward by the number of lines in the window.

If you do not explicitly specify an amount to scroll, the default increment is HALF.

BOTTOM
scrolls downward until the last line that contains a variable definition is displayed.

CANCEL
closes the FSVIEW NEW window and ends the FSVIEW session. The new data set is not created.

END
closes the FSVIEW NEW window, creates the SAS data set that was defined in the window, and opens an FSVIEW window for editing observations in the newly created data set.

FORWARD <n | HALF | PAGE>
scrolls vertically toward the bottom of the window. You can scroll forward only if you have filled the last blank variable-definition line that is currently displayed or if there are more variables to be displayed. The following scroll amounts can be specified:
n scrolls downward by the specified number of lines.
HALF scrolls downward by half the number of lines in the window.
PAGE scrolls downward by the number of lines in the window.

If you do not explicitly specify an amount to scroll, the default increment is HALF.

LEFT
displays the FORMAT column when the INFORMAT column is displayed or vice versa.

RIGHT
displays the INFORMAT column when the FORMAT column is displayed or vice versa.

TOP
scrolls upward until the first variable-definition line is displayed.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.