Chapter Contents

Previous

Next
SAS/FSP Software Procedures Guide

Viewing and Editing Observations

In the FSEDIT procedure, observations are viewed and edited in the FSEDIT window. By default, this window is opened when you begin an FSEDIT session. If you use the procedure to create a new data set, the FSEDIT window is opened after the structure of the new data set has been defined in the FSEDIT NEW window.

Typical FSEDIT Window shows the features of a typical FSEDIT window. The window includes fields that contain the values of variables in the data set, as well as labels that identify the fields.

Typical FSEDIT Window

[IMAGE]

By default, the window's title bar includes both the name of the current data set and the current observation number. No observation number is displayed when the engine that is being used to read the data set does not support access by observation number. For example, observation numbers are not displayed when the data set is compressed.

Unless you use a WHERE statement in conjunction with the PROC FSEDIT statement, all observations in the data set are available for editing. The FSEDIT procedure ignores the FIRSTOBS= and OBS= system options.

CAUTION:
The FSEDIT procedure edits a data set in place. The FSEDIT procedure does not leave an unedited copy of the original. If you need to preserve a copy of the original data, be sure to make a copy of the data set before you begin editing.  [cautionend]


How the Control Level Affects Editing

The editing behavior of the FSEDIT procedure depends on which control level is selected when the data set is opened. The control level is the degree to which the procedure can restrict access to the data set.

The FSEDIT procedure supports two levels of control:
record locks only the observation that is currently being edited. With this control level, you can open multiple FSEDIT windows for browsing or editing the same data set. Using SAS/SHARE software, other users can edit the same data set simultaneously.
member locks the entire data set. No other window or user can open the data set while this control level is in effect.

By default, the FSEDIT procedure selects record-level control when it opens a SAS data set. You can specify the control level with the UPDATE command in the FSEDIT window, or by using the CNTLLEV= data set option with the data set name in the PROC FSEDIT statement or in the FSEDIT command. See FSEDIT Window Commands for details about the UPDATE command. The CNTLLEV= data set option is described in SAS Language Reference: Dictionary.


Scrolling

When the FSEDIT window is opened, an initial observation is displayed for editing. Scroll forward or backward to view other observations.

If an observation contains more variables than can be displayed in the FSEDIT window at one time, the information in each observation is divided into discrete units called screens. Each screen contains as many variable fields as will fit in the FSEDIT window. Scroll right or left to move among the screens to view the additional variables.

Note:   The FSEDIT window supports a maximum of 100 screens per observation. If you attempt to open a data set that has an extremely large number of variables, such that more than 100 screens would be required to accommodate all of the variables, then only variables that fit within 100 screens are displayed. You can use the VAR statement in conjunction with the PROC FSEDIT statement to restrict the number of variables that are displayed in the FSEDIT window.  [cautionend]


Adding Observations

There are two ways to add observations to the data set:

The new observation is not actually added to the data set until you move to another observation, save the data set, or end the procedure. You can cancel the observation before it is added to the data set.


Entering and Editing Variable Values

To enter a value for a variable, simply type the value in the entry field (usually indicated by underscores) that follows the variable name or label. To edit a value, type the new value over the old value.

When an observation is displayed for editing, you can enter values only on the command line and in entry fields. All other areas of the window are protected.


FSEDIT Window Commands

In addition to the global commands that are discussed in SAS/FSP Software Global Commands, you can use the following commands while editing observations:
Scrolling

n
=n
=variable
BACKWARD
BOTTOM
FORWARD
LEFT
RIGHT
TOP

Searching

FIND search-criterion <... search-criterion-n>
FIND@ search-criterion <... search-criterion-n>
LOCATE | LOC search-value
LOCATE: | LOC: search-string
NAME <variable>
RFIND
SEARCH search-string
SEARCH@ search-string <... search-string-n>
STRING variable <... variable-n>

Editing Observations

ADD
CANCEL
CURSOR
DELETE
DUP
OVERRIDE
UPDATE <RECORD | MEMBER>

Saving Data

AUTOSAVE <n>
END
SAVE

Creating Letters and Reports

(These commands are valid only if the LETTER= option is used in the PROC FSEDIT statement.)

EDIT letter-name
LETTER
SEND letter-name

Other

KEYS
MODIFY <password>
REREAD
WHERE <<ALSO> expression> | <UNDO | CLEAR>


Command Descriptions

Here are descriptions of the FSEDIT window commands:

n
displays the specified observation. If the n value is greater than the number of observations in the data set, the last observation in the data set is displayed.

This command is not valid when the engine that is being used to read the data set does not support access by observation number or when a permanent or temporary WHERE clause is in effect.

=n
displays the specified screen of the current observation in a multiscreen application. If the =n value is greater than the number of screens in the application, the highest-numbered screen of the current observation is displayed.

This command has no effect if the FSEDIT window does not use multiple screens.

=variable
positions the cursor on the entry field for the specified variable.

This command is particularly useful in multiscreen applications and in custom displays.

ADD
creates a new blank observation for the data set and displays it so that you can enter values.

The new observation is not actually added to the data set until you scroll to another observation, issue a SAVE command, or end the FSEDIT session. You can use the CANCEL or DELETE commands to cancel the new observation before it is added to the data set.

AUTOSAVE <n>
specifies how frequently the procedure automatically saves the data set. The n value determines the number of observations that must be modified (changed, added, or deleted) before an automatic save is performed. By default, the FSEDIT procedure saves the data set automatically whenever 25 observations have been modified since the last save.

To check the current value of the AUTOSAVE parameter, issue the AUTOSAVE command without specifying an n value.

When creating a FSEDIT application, you can change the default AUTOSAVE value by changing the Autosave value field in the FSEDIT Parms window.

Regardless of the AUTOSAVE value, you can save the data set at any time by using the SAVE command.

BACKWARD
displays the previous observation.

BOTTOM
displays the last observation in the data set.

Note:   Some engines do not support the BOTTOM command.  [cautionend]

CANCEL
cancels all changes that have been made to the current observation. You can cancel changes only while the observation is displayed. Once you scroll to another observation or issue a SAVE command, the changes cannot be canceled.

CURSOR
selects the position on the display (usually in a variable field) where the cursor is positioned each time an observation is displayed. To specify the position, type CURSOR on the command line, move the cursor to the desired position, and press ENTER.

DELETE
marks the displayed observation for deletion. After you move to another observation, you cannot return to a deleted one.

Depending on which engine is used, deleted observations may not be physically removed from the data set, even though they are no longer accessible. To remove deleted observations, use a DATA step or any other process, such as the SORT procedure, that re-creates the data set.

Note:   Some engines, such as the V5 engine, do not support deleting observations. In this case, the DELETE command merely resets all variables in the observation to missing values.  [cautionend]

DUP
creates a duplicate of the displayed observation and displays the newly created observation for editing. Duplicating an observation is useful when you are adding an observation whose values are similar to those of an existing observation.

The duplicate observation is not actually added to the data set until you scroll to another observation, issue a SAVE command, or end the FSEDIT procedure. You can use the CANCEL or DELETE commands to cancel the new observation before it is added to the data set.

EDIT letter-name
initiates the FSLETTER procedure and displays the specified document for editing in the FSLETTER window. The letter-name value is the one-level name of a LETTER entry in the SAS catalog that is specified in the LETTER= option of the PROC FSEDIT statement that initiates the FSEDIT session. (The EDIT command is valid only when the LETTER= option is used in the PROC FSEDIT statement.) If the LETTER entry does not already exist, it is created.

If you use the SEND command in the FSLETTER window, fields in the document are filled with the values of corresponding variables from the current FSEDIT observation during the FSLETTER send step. When you end the FSLETTER session, the FSEDIT session resumes.

For more information about creating letters and other documents, refer to The FSLETTER Procedure. See also the LETTER and SEND commands.

END
saves the data set, closes the FSEDIT window, and ends the FSEDIT session.

FIND search-criterion ... search-criterion-n
locates and displays the next observation that meets the specified criteria. The general form of the search-criterion value is

variable-name comparison-operator search-value
where

The following restrictions apply to the search-value value:

The command plus the string cannot be longer than 256 characters. Also, you cannot specify more than 20 find variables.

If a list of criteria is specified, all those criteria must be met in order for an observation to be selected. For example, the following command locates only observations for which the YRS variable contains the value 3 and the STATE variable contains NC:

find yrs=3 state=NC
The command will not locate observations that meet only one of the criteria. Use the FIND@ command to locate observations that meet some but not all of the conditions in the list.

After you issue a FIND command, you can use the RFIND command to repeat the search for the next matching observation.

You can interrupt a FIND operation that is in progress. This feature is useful when you want to halt a search request while editing or browsing a large data set. To halt an active FIND operation, press the interrupt key or key combination for your system. The FSEDIT procedure halts the operation and displays the following message:

NOTE: Search was discontinued due to user break request.

To resume the search, issue an RFIND command.

Note:   The key or key combination you use to interrupt an active process depends on your host operating system and terminal device. For example, some systems have a key that is labeled BREAK or ATTENTION (or ATTN). Other systems use a combination of the CTRL key and another key. Refer to your host documentation if you are unfamiliar with the interrupt key for your operating system and terminal device.  [cautionend]

See also the FIND@ and RFIND commands.

FIND@ search-criterion <... search-criterion-n>
locates and displays the next observation that meets at least one criterion in a list of criteria. For example, use the following command to locate an observation that has either a value greater than 1 for the variable YRS or the value NC for the variable STATE:
find@ yrs>1 state=NC

See the discussion of the FIND command for an explanation of the format for search-criterion values.

After you issue a FIND@ command, you can use the RFIND command to repeat the search for the next matching observation.

FORWARD
displays the next observation.

KEYS
opens the KEYS window for browsing and editing function key definitions for the FSEDIT window. Function key definitions are stored in catalog entries of type KEYS.

The default key definitions for the FSEDIT window are stored in the FSEDIT.KEYS entry in the SASHELP.FSP catalog. If you are using this default set of key definitions when you issue the KEYS command and you change any key definitions in the KEYS window, a new copy of the FSEDIT.KEYS entry is created in your personal PROFILE catalog (SASUSER.PROFILE, or WORK.PROFILE if the SASUSER library is not allocated). The changes that you make are recorded in your personal copy of the KEYS entry.

Note:   The FSEDIT and FSBROWSE procedures use the same default KEYS entry. Changes that you make in the FSEDIT window also affect the default key definitions for the FSBROWSE window.  [cautionend]

If your FSEDIT session does not use an existing SCREEN entry, you can specify a KEYS entry for your FSEDIT session by using the KEYS= option with the PROC FSEDIT statement. If you do use an existing SCREEN entry, the KEYS entry name that is recorded in the SCREEN entry is used. If you issue a KEYS command when a KEYS entry has been specified, the FSEDIT procedure looks for that entry first in the catalog that contains the SCREEN entry (if a SCREEN entry is used), then in your personal PROFILE catalog. The first KEYS entry found that has the specified name is opened for editing.

If the specified KEYS entry is not found in either catalog, then all function key definitions are blank when the KEYS window is opened. If you then enter key definitions, the specified entry is created when the KEYS window is closed. The new entry is created in the catalog that contains the current SCREEN entry if a SCREEN entry is used; otherwise, it is created in your personal PROFILE catalog.

LEFT
scrolls to the previous screen of the current observation. This command is valid only in multiscreen applications.

LETTER
initiates the FSLETTER procedure and opens the FSLETTER DIRECTORY window to display the directory of the SAS catalog that was specified in the LETTER= option. This command is valid only if you specify the LETTER= option in the PROC FSEDIT statement that initiates the FSEDIT session.

From the FSLETTER DIRECTORY window, you can create new documents, or you can select existing documents for editing or printing. If you issue a SEND command in the FSLETTER window, fields in the document are filled with the values of the corresponding variables from the current FSEDIT observation. When you end the FSLETTER session, the FSEDIT session resumes.

LOCATE search-value
LOC search-value
locates and displays the next observation that contains a variable value that exactly matches the specified numeric or character value. The FSEDIT procedure searches for the matching value in the variable field that was identified in the most recent NAME command.

The following restrictions apply to the search-value value:

The LOCATE command finds only observations for which the specified search value exactly matches the variable value. Use the LOCATE: or SEARCH command to find partial matches.

After you issue a LOCATE command, you can use the RFIND command to repeat the search for the next observation that contains the specified value.

You can interrupt a LOCATE operation that is in progress. This feature is useful when you want to halt a search request while editing or browsing a large data set. To halt an active LOCATE operation, press the interrupt key or key combination for your system. The FSEDIT procedure halts the operation and displays the following message:

NOTE: Search was discontinued due to user break request.

To resume the search, issue an RFIND command.

Note:   The key or key combination you use to interrupt an active process depends on your host operating system and terminal device. For example, some systems have a key that is labeled BREAK or ATTENTION (or ATTN). Other systems use a combination of the CTRL key and another key. Refer to your host documentation if you are unfamiliar with the interrupt key for your operating system and terminal device.  [cautionend]

See also the LOCATE:, NAME, and RFIND commands.

LOCATE: search-string
LOC: search-string
locates and displays the next observation that contains a variable value for which the beginning characters match the specified character value. The FSEDIT procedure searches for the matching value in the variable field that was specified in the most recent NAME command. See the description of the LOCATE command for a list of restrictions on the search value.

Note:   For numeric variables, the LOCATE: command finds only exact matches (like the LOCATE command). You cannot search for partial matches in numeric variables.  [cautionend]

The LOCATE: command finds only observations for which the specified search value matches the beginning characters of the variable value. For example, the following command finds occurrences of both Burlington and Burnsville:

locate: Bur

Use the SEARCH command to find matches anywhere in the variable value rather than just at the beginning.

After you issue a LOCATE: command, you can use the RFIND command to repeat the search for the next observation that contains the specified value.

See also the LOCATE, NAME, and RFIND commands.

MODIFY <password>
opens the FSEDIT Menu window, from which you can customize the appearance and behavior of the FSEDIT environment.

If the application you are using is password-protected, you must specify the assigned password with the MODIFY command before you can modify the SCREEN entry.

NAME <variable>
specifies the data set variable that will be searched by subsequent LOCATE or LOCATE: commands. (Computed variables cannot be used as search variables.) Issue the NAME command alone to display the current NAME variable.

For example, to find observations that contain particular values of a variable named DISTRICT, issue this command:

name district
Then specify the desired district value in a LOCATE command to find observations that belong to a specific district.

In an application, you can specify a default search variable in the FSEDIT Parms window.

See also the LOCATE and LOCATE: commands.

OVERRIDE
cancels all outstanding error conditions, permitting you to exit an observation even though you have entered values that are outside of the acceptable range or have left some required fields empty. Values that are flagged as outside the acceptable range are recorded in the data set as entered. Values for fields in which nothing was entered are recorded as missing values.

Note:   When you are using an FSEDIT application, the OVERRIDE command is valid only if the application allows overriding. Applications developers can block the overriding of error conditions that are caused by blank required fields, by values outside the acceptable range, or both.  [cautionend]

REREAD
updates the current observation with the saved variable values from the data set.

RFIND
repeats the most recent FIND, FIND@, LOCATE, LOCATE:, SEARCH, or SEARCH@ command.

RIGHT
scrolls to the next screen of the current observation. This command is valid only in multiscreen applications.

SAVE
saves the SAS data set that you are editing without ending the FSEDIT session. You can issue a SAVE command at any time while you are editing observations.

See also the AUTOSAVE command.

SEARCH <search-string>
locates and displays the next observation that contains a variable value that includes the specified character value. (The SEARCH command is valid only for character variables.) The FSEDIT procedure searches for the value in the variable fields that were identified in the most recent STRING command.

The following restrictions are applicable to the search-string value:

If a list of values is specified, all of the strings must occur in an observation in order for it to be located. For example, the following command locates only observations for which the specified variables include both the strings Smith and NC:

search Smith NC

The strings can occur in two different variable values (if more than one variable is named in the STRING command) or both in the same variable value.

To find observations that contain some but not necessarily all of the values in the list, use the SEARCH@ command.

After you issue a SEARCH command, you can use the RFIND command to repeat the search for the next observation that contains the specified value.

You can interrupt a SEARCH operation that is in progress. This feature is useful when you want to halt a search request while editing or browsing a large data set. To halt an active SEARCH operation, press the interrupt key or key combination for your system. The FSEDIT procedure halts the operation and displays the following message:

NOTE: Search was discontinued due to user break request.

To resume the search, issue an RFIND command.

Note:   The key or key combination you use to interrupt an active process depends on your host operating system and terminal device. For example, some systems have a key labeled BREAK or ATTENTION (or ATTN). Other systems use a combination of the CTRL key and another key. Refer to your host documentation if you are unfamiliar with the interrupt key for your operating system and terminal device.  [cautionend]

See also the SEARCH@, STRING, and RFIND commands.

SEARCH@ search-string <... search-string-n>
locates and displays the next observation that contains variable values that include one or more of the specified character values. (The SEARCH@ command is valid only for character values.) The FSEDIT procedure searches for the values in the variables that were identified in the most recent STRING command. See the description of the SEARCH command for restrictions that apply to the character-string value.

For example, the following command displays the next observation that contains either Cary, Raleigh, or Chapel Hill in one of the variables identified in the STRING command:

search@ Cary Raleigh 'Chapel Hill'

After you issue a SEARCH@ command, you can use the RFIND command to repeat the search for the next observation that contains the specified value.

See also the SEARCH, STRING, and RFIND commands.

SEND letter-name
initiates the FSLETTER procedure in its send step, displays the specified document, and fills any entry fields in the document with corresponding variable values from the current observation. The SEND command is valid only when the LETTER= option is used in the PROC FSEDIT statement that initiates the FSEDIT session.

The letter-name value is the one-level name of an existing LETTER entry in the SAS catalog that is specified in the LETTER= option of the PROC FSEDIT statement. An error message is printed if the specified LETTER entry does not exist.

Use the END command to enter the second stage of the send step, or use the CANCEL command to cancel the FSLETTER session. When you end the FSLETTER session, the FSEDIT session resumes.

The SEND command provides a method for producing one copy of a document for one observation. See The FSLETTER Procedure for more details.

STRING <variable <... variable-n>>
identifies the data set variable or variables that will be searched by subsequent SEARCH and SEARCH@ commands. The variables that are specified with the command must be character variables in the data set. Computed variables cannot be used as search variables.

For example, the following command causes the next SEARCH or SEARCH@ command to search the two specified variables:

string address1 address2

If you forget which variables are currently identified, issue the STRING command with no following values to display the current variables on the window's message line.

In a custom application, you can specify default search variables in the FSEDIT Parms window.

TOP
displays the first observation in the data set.

UPDATE <RECORD | MEMBER>
changes the control level of an FSEDIT window.

The UPDATE command fails if the specified control level would cause a locking conflict. For example, you cannot specify UPDATE MEMBER if the same data set is open with a control level of RECORD in another FSEDIT session.

WHERE <<ALSO> expression> | <UNDO | CLEAR>
imposes one or more sets of conditions that observations in the data set must meet in order to be processed. Expression is any valid WHERE expression that includes one or more of the variables in the input data set. (Refer to the description of the WHERE statement in SAS Language Reference: Dictionary for details about the operators and operands that are valid in WHERE expressions.) Observations that do not satisfy the specified conditions cannot be displayed or edited.

The complete set of conditions that are imposed by a WHERE command is called a temporary WHERE clause. These conditions can be modified or canceled during the FSEDIT session. In contrast, a WHERE statement that is submitted by the PROC FSEDIT statement defines a permanent WHERE clause that cannot be changed or canceled during the FSEDIT session and which is not affected by WHERE commands. See WHERE Statement for details.

The word Where appears in the upper right corner of the window border whenever a temporary WHERE clause is in effect.

The WHERE command has the following forms:

WHERE expression
applies the conditions that are specified in expression as the new temporary WHERE clause, replacing any clause previously in effect.

WHERE ALSO expression
adds the conditions that are specified in expression to any existing temporary WHERE clause.

WHERE UNDO
deletes the most recently added set of conditions from the temporary WHERE clause.

WHERE
WHERE CLEAR
cancels the current temporary WHERE clause.

Whenever you change the temporary WHERE clause, the procedure scrolls to the first observation in the data set that meets the specified conditions. When you cancel the temporary WHERE clause, the procedure displays the first observation in the data set.

If you edit values in an observation so that it no longer meets the conditions of the WHERE clause, that observation can still be displayed and be edited. However, a warning message is printed whenever the observation is displayed, indicating that the observation no longer meets the WHERE conditions.

When you use the ADD or DUP commands to add a new observation, you can enter values that do not meet the WHERE conditions. However, once you scroll to another observation, that observation cannot be displayed or edited again while the WHERE clause is in effect.


Chapter Contents

Previous

Next

Top of Page

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