SAS II
Terms
undefined, object
copy deck
- True or False: Placing an explicity OUTPUT statement in a DATA step overrides the implicit output, and SAS adds an observation to a data set only when an explicit OUTPUT statement is executed.
- true
- When a data set is ________, the values of an observation in the input data set become values of a variable in the output data set.
- rotated
- A ___ statement can be used within IF-THEN/ELSE statements to designate a group of statements to be executed, depending on whether the IF condition is true or false.
- do
- True or False: If you do not specify a SAS data set name or the reserved name _NULL_ in a DATA statement, then by default SAS automatically creates data sets with the names data1, data2, and so on in the work library.
- true
- You can output to multiple data sets by separating the data set names with a _______ after the output statement.
- space
-
An alternate form of conditionally executing statements uses _______ groups.
______ <expression>;
WHEN ( )
statement;
WHEN ( )
statement;
OTHERWISE statement;
END; - select
- You can use the ______ and _____ data set options to write different variables to different data sets.
- drop=, keep=
- True or False: You can specify the DROP= or KEEP= data set options in the OUTPUT statement.
- false
-
True or False: In the Data step, the DROP and KEEP statements apply only to output SAS data sets.
However, the DROP= and KEEP= data set options can apply to both input and output SAS data sets. - true
- True or False: You can use the DROP= and KEEP= data set options along with the DROP and KEEP statements in PROC steps.
- false
-
SAS applies data set options to input data sets before it
*__________ programming statements
*applies data set options to ________ data sets - evaluates, output
- True or False: If a DROP or KEEP statement is used at the same time as a data set option, the data set option is applied first.
- false
-
SAS processes a SAS data set from first obs to last obs by default.
The _______ and ______ data set options can be used to control which observations are processed. - firstobs=, obs=
- True or False: You can use FIRSTOBS= and OBS= with input data sets only. You cannot use either data set option in the DATA statement.
- true
- The ________ data set option specifies the number of the last observation to process, NOT how many observations should be processed.
- obs=
-
To guarantee that SAS processes all observations from a data set, you can use:
SAS-data-set(OBS=_____) - max
- The ______ data set option specifies a starting point for processing an input data set.
- firstobs=
- _______ and _______ are often used together to define a range of observations to be processed.
- firstobs=, obs=
- True or False: The FIRSTOBS= system option for the individual data set overrides the FIRSTOBS= data set option.
- false
-
How many observations will be read?
set prog2.military(firstobs=11 obs=25);
25, 15, 14, or 36 ? - 15
- True or False: The DROP= and KEEP= data set options cannot be used to exclude variables from processing during a PROC step.
- false
- True or False: DROP= and KEEP= do NOT affect the order in which the variables are processed.
- true
-
You can use the DATA step to write:
* a custom _______
* data to an _______ file to be read by programming languages or software. - report, external
- You can use the _________ procedure to read data from a SAS data set and write it to an external data source.
- export
- The ______ statement specifies at least one data set name that the SAS System uses to create an output data set.
- data
- Using the _______ keyword as the data set name causes SAS to execute the DATA step without writing observations to a data set.
- _NULL_
- The ______ statement can be used to specify the output destination for subsequent _____ statements in the DATA step.
- file, put
- True or False: You can use the FILE statement in conditional processing because it is executable.
- true
- The default file-specification for the FILE statement is _____.
- log
- A form of file-specification in the FILE statement that specifies the physical name of an external file, which is enclosed in quotes.
- 'external-file'
- A form of file-specification in the FILE statement that specifies the file reference for an external file. You must have previously associated it with an external file in a FILENAME statement or function, or in an appropriate operating environment comman
- fileref
- A form of file-specification in the FILE statement that is a reserved file reference that directs the output from subsequent PUT statements.
- log
- A form of file-specification in the FILE statement that is a reserved file reference that directs the output from subsequent PUT statements to the same file as the output that is produced by SAS procedures.
- True or False: You can only use one FILE statement to write multiple external files in a single DATA step.
- false
- True or False: You can use PRINT as your inital file-specification in the FILES statement to verify the contents of your output before creating an external file.
- true
- The _______ statement associates a SAS file reference with an external file or an output device.
- filename
- In the FILENAME statement fileref specifies any SAS _____.
- name
- In the FILENAME statement, this specifies any SAS name.
- fileref
- In the FILENAME statement, this specifies type of device or the access method that is used if the fileref points to an input or output device or location that is not a physical file.
- device-type
- In the FILENAME statement, this specifies a physical name of an external file. The physical name is the name that is recognized by the operating environment.
- 'external-file'
- In the FILENAME statement, these are used to specify details, such as file attributes and processing attributes, that are specific to your operating environment.
- host-options
- The _____ statement can write lines to the external file taht is specified in the most recently executed FILE statement.
- put
- You list the variables whose values you want written in the PUT statement wiht simple ______ _______.
- list output
- The PUT statement writes a ________ value, inserts a ______, and then writes the next value.
- variable, blank
- True or False: When a quoted character string is used to specify a string of text to write in a PUT statement, SAS automatically inserts a blank space.
- false
- In the PUT statement, the values of character variables are _____-aligned in the field; leading and trailing blanks are removed.
- left
- The null PUT statement used to output a blank line.
- put;
- A ________ list output increases the versatility of the PUT statement because you can specify a SAS format to control how the variable values are written.
- modified
- To use modified list output in the PUT statement, user the _____ format modifier between the variable name and format.
- colon
- True or False: In Modified List Output, all leading and trailing blanks are deleted, and each value is followed by a single blank.
- true
- The _______ procedure enables you to browse external files with an interactive SAS session.
- fslist
- True or False: You can use the FSLIST procedure to browse SAS data sets.
- false
-
PROC FSLIST ______=file specification <option(s)>;
RUN; - fileref
- The _____ automatic variable is created by every DATA step.
- _N_
- Each time that that the DATA step loops past the DATA statement, _N_ is incremented by __. Therefore, the data value of _N_ represents the number of times that the DATA step _______.
- 1, iterated
- True or False: _N_ is added to the Program Data Vector (PDV) and is outputted.
- false
- Be careful in a PUT statement of __________ lines within a quoted string because it will produce unexpected results.
- indenting
- To add a single column of column headers before the rows of data to an external file, you can use ___ put statements or use if _N_ = ___ then put....
- 2, 1
- The ______ option in the SET statement creates and names a temporary variable that acts as an end-of-file indicator.
- end=
- The temporary variable created by the end= option in the SET statement is initialized to __. WHen the SET statement reads the last observation of the data set listed, the value of the variable is set to ___. The variable is not added to any new data set.
- 0,1
- END= is an option in the _____ statement. It is not a data set option; it is not enclosed in _____.
- set, parentheses
- Use the _____ option in the FILE statement to create a file with an alternate delimiter (other than a blank).
- dlm=
- For the DLM= option in the FILE statement, you can specify a _________ variable whose value contains your delimeter instead of a quoted string.
- character
- The ______ option in the FILE statement will add quotes. (deliminated separated data)
- dsd
- The _______ statement prevents SAS from re-iitializing the values of new variables at the top of the DATA step.
- retain
-
The RETAIN statement
* retains the value of the variable in the PDV across ______ of the DATA step.
* initializes the retained variable to ________ before the first execution of the DATA step if an inital value is not specified
* is a ___ - iterations, missing, compile
- The RETAIN statement has no effect on variables that are read with ______, ______, or UPDATE statements; values read from ____ data sets are automatically retained.
- set, merge, sas
- True or False: A variable referenced in the RETAIN statement appears in the output SAS data set only if it is not given an initial value or referenced elsewhere in the DATA step.
- false
- If you do not supply an initial value in the retain statement, all the values of your variable will be __________.
- missing
- In SAS, the result of any mathematical operation on a missing value is ______.
- missing
- If there are missing values in the data, you need to use a ________ in order to not get a missing value as the result of a mathematical operation.
- function
- When you create an accumulating total variable, an alternative to the RETAIN statement is the _____ statement.
- sum
- True or False: The sum statement does not begin with a keyword.
- true
-
The SUM statement:
* creates the variable on the ___ side of the plus sign if it does not already exist.
* initializes the variable to ____ before the first. iteration of the data step
* automatically ________ the variable.
* adds the - left, zero, retains, expression, execution, missing
- You can rearrange the observations into groups using the _______ procedure.
- sort
-
The SORT procedure:
* rearranges the observations in a DATA set
* can sort on ______ observations
* creates a SAS data set that is a _______ copy of the input data set
*replaces the input data set by ______ - multiple, sorted, default
- The ____ statement in the DATA step enables you to process your data into groups.
- by
-
When a BY statement is used with a SET statement, the data must
* be sorted or grouped in order by the ____ variable(s), or
*have an _____ based on the ____ variable(s), or
*reside in a ______ table - by, index, by, DBMS
-
The _______ variable has a value of 1 for the first observation in a BY group; otherwise, it equals 0;
The ______ variable has a value of 1 for the last observation in a BY group; otherwise, it equals 0. - first., last.