SAS
Terms
undefined, object
copy deck
- What are the two portions of the SAS data set?
- Descriptor and Data
- What does the descriptor portion of a SAS data set contain?
- General information about the SAS data set and variable attributes
- Which portion of a SAS data is displayed by the CONTENTS procedure?
- Descriptor
- The two types of SAS variables
- Character and Numeric
- Character values are stored with a length of 1 to __________ ?
- 32,767
- One character = ____ byte (s)
- One
- Default number of bytes for a numeric variable
- 8
-
Select the valid default SAS names:
data5mon
5monthsdata
data#5
five months data
fivemonthsdata - data5mon, fivemonthsdata
- True or False: SAS stores date values as character values.
- False
- A SAS date is stored as teh number of days between this date and a date you specify.
- January 1, 1960
- The SAS procedure that displays the data portion of a SAS data set
- PRINT procedure
-
SAS procedure which displays:
all observations
all variables
an Obs column on the left side - PRINT Procedure
- True or False: Observations are in columns
- False
- True or False: Variables are in rows.
- False
- SAS statements usually begin with a ________________ .
- keyword
- Every SAS statement ends with a _______.
- semicolon
- Character variable values can be up to ______ characters long and use ___ byte(s) of storage per character.
-
32,767
1 - A SAS variable name has __ to __ characters and begins with a ______ or an ____________.
-
1
32
letter
underscore - By default, numeric variables are stored in _ bytes of storage.
- 8
- The internally stored SAS date value for January 1, 1960 is _.
- 0
- A missing character value is displayed as a _____.
- blank
- A missing numeric value is displayed as a _____.
- period
- What are the two kinds of steps?
- DATA and PROC
- What are the two portions of every SAS data set ?
- Descriptor and Data
- What are the two types of variables?
- Character and Numeric
- What are the two major parts of SAS output?
- SAS Log and Output
- True or False: If a SAS program produces output, then the program ran correctly and there is no need to check the SAS log.
- False
- True or False: Omitting a semicolon never causes errors.
- False
- A collection of SAS files that are recognized as a unit by SAS.
- SAS data library
- Statement to assign a library
- Libname
- True or False: The libref work can be omitted when you refer to a file in the work library.
- True
- Keyword in PROC Contents to list all the SAS files in the library.
- _ALL_
- Option to suppress the descriptor portions of the data sets in PROC Contents.
- NODS
- To explore the descriptor portion of a SAS data set, specify the data set name in this option.
- DATA=
-
SAS Procedure that displays:
* titles and footnotes
* descriptive column headings
* formatted data values - PRINT procedure
- PROC Print creates a ______ report
- List
- Statement in the print procedure which enables you to select variables to include in the report and define the order of variables in the report.
- Var
- True or False: The var statement does not order the variables to print in PROC Print
- False
- Option in PROC Print that supresses the row numbers on the left side of the report.
- NOOBS
-
Which statement
*enables you to select observations that meet a certain condition
*can be used with most SAS procedures ? - where
- The where statement in the PRINT procedure allows you to _______ the data.
- subset
-
Statment that includes:
comparison operators
logical operators
special operators
functions - where
- Operator in the where statement that allows commas or blanks to separate values
- IN
- Special operator which selects observations in which the value of the variable falls within a range of values, inclusively.
- Between-And
- Special operator which selects (contains) observations that include the specified substring.
- ?
- Statement which produces column totals in PROC Print.
- sum
- Statement that produces subtotals if you print the data in groups in PROC Print.
- sum
- Option that prints the number of output observations at the end of the report.
- n
-
SAS Procedure which:
*rearranges the observations in a SAS data set
*can create a new SAS data set containing the rearranged observations
*can sort on multiple variables
*can sort in ascending (default) or desc - SORT Procedure
- Data must be indexed or in sorted order to use a ___ statement in a PROC Print step.
- BY
- Using a __ statement and a ___ statement together in a PROC Print step produces subtotals and grand totals.
-
BY
SUM - Use this statement to put each subroup on a separate page in PROC Print.
- PAGEBY
-
The statement in PROC Print that enables you to
*suppress the Obs column in the report
*specify which variable(s) should replace the Obs column - ID
-
When this combination of statements specify _______
*The Obs column is suppressed,
*the BY line is suppresed,
*the ID/BY variable prints in the leftmost column,
*each ID/BY value only prints at the start of ea - ID and BY specify the same variable
- Default sort order of PROC Sort
- ascending
- Special where statement operator that selects observations by comparing character values to specified patterns.
- like
-
where Code like 'E_U%';
An underscore replaces __ character(s) and % replaces __ of character(s). - 1, any number
- Special where statement operator that selects observations that contain spelling variations of the word or words specified.
- sounds like (=*)
- For the special where statement operator sounds like, IS ___ or IS ______ selects observations which the value of the variable is missing.
- null, missing
- Syntex for a title and a footnote in a PROC PRINT.
-
titlen 'text';
footnoten 'text'; - Titles appear at the ____ of the page.
- top
- The default title is
- The SAS System
- The value of n in titles and footnotes can be from __ to __.
- 1 to 10
- An unnumbered title is equivalent to _____.
- title1
- True or False: Titles change every time you submit your program.
- False
- The null title statement that cancels all titles.
- title;
- Footnotes appear at the _____ of the page.
- bottom
- The default footnote.
- none
- True or False: Footnotes remain in effect until they are changed, cancelled, or you end your SAS session.
- True
- The null footnote statement.
- footnote;
- Statement used in Proc Print to replace variable names in SAS output and also used automatically by many procedures.
- label
- True or False: The OPTIONS statement is NOT usually included in a PROC or DATA step.
- True
- 'label' in the label statement specifiesa label up to ____ characters.
- 256
- Specifies to print the date and time the SAS session began at the top of each page of the SAS output in the OPTIONS statement.
- date
- Specifies not to print the date and time the SAS session began in the OPTIONS statement.
- nodate
- Specifies the line size for the SAS log and SAS output.
- linesize=width or ls=width
- Specifies the number of lines (n) that can be printed per page of SAS output.
- pagesize=n or ps=n
- Specifies that page numbers be printed out on the first line of each page of output in the OPTIONS statement.
- number(default)
- Specifies that page numbers not be printed in the OPTIONS statement.
- nonumber
- Specifies a beginning page number (n) for the next page of SAS output in the OPTIONS statement.
- pageno=n
- _______ nodate nonumber ls=72;
- options
- In OPTIONS statement resets date and time to your system clock.
- dtreset
- True or False: When SAS formats are used to format data values the values in the SAS data set are changed.
- False
- Statement used in PROC PRINT to enhance the readability of reports or recode data values.
- format
- To format multiple variables with the format statement, use a ____.
- dash
-
In the SAS format form,
<$>format<w>.<d>, the $ indicates a ___________ format. - character
-
In the SAS format form,
<$>format<w>.<d>, w means _____ _____. - total width
-
True or False:
In the SAS format form,
<$>format<w>.<d>, the . is not a required delimiter - False
-
In the SAS format form,
<$>format<w>.<d>, the d is ___________. - number of decimal places
-
w.d
8.2
width = ___, ___ decimal places - 8,2
-
$w
$5
standard _______ format
width = ___ - character,5
-
commaw.d
comma9.2
_______ in a number,
width = __, __ decimal places - commas, 9, 2
-
dollarw.d,
dollar10.2
______ in a number
width= ___, ___ decimals - dollar signs and commas, 10, 2
- True or False: If you do not specify a format width large enough to accommodate a numeric value, the displayed value is automatically adjusted to fit into the width.
- True
- A SAS date is stored as the number of days between _________ and the specified date.
- 01JAN1960
- Format for 01/01/60.
- MMDDYY8.
- Format for 01JAN1960.
- MMDDYY10.
- Format for 101601.
- MMDDYY6.
- Format for 16OCT01.
- Date7.
- Format for 16OCT2001.
- Date9.
- Format for December 31, 1959.
- Worddate.
- Format for 31/12/1960.
- DDMMYY10.
- Format for Sunday, January 1, 1961.
- Weekdate.
- To turn the byline back on, use this in the OPTIONS statement.
- byline
- Using this procedure you can create user-defined formats.
- FORMAT procedure
-
In the format procedure the form is:
PROC FORMAT;
_____ format-name range1='label'
range2='label'
...;
RUN; - value
-
In PROC FORMAT,
Format-name:
*cannot be more than __ characters in SAS 9 and __ in previous versions.
*for character values, must have a _ as the first character. - 32,8, $
-
In PROC FORMAT, labels can be up to ______ characters in length
are typically in ______ , although it is not required - 32,767, quotes
- Format names in PROC Format are limited to _ characters prior to SAS version 9.
- 8
-
proc print data=ia.empdata;
format Salary money.;
run;
A period is needed after money so SAS doesn't think that it is a ________ . - variable
- The ____ _____ statement opens, closes, and manages the HTML destination.
- ODS HTML
-
what is wrong with the format?
ODS HTML FILE= filename;
sas code
ODS HTML CLOSE; - need quotes around filename
-
_____ is directed to the specified HTML file until you
*close the HTML destination
*specify another destination file - Output
- To read in a raw data file, use the _______ statement in the data step.
- infile
-
statement which:
*names the SAS variables
*identives the variables as character or numeric
*specifies the locations of the fields in the raw data
*can be specified as column, formatted, list, or named input - input
-
______ input is appropriate for reading
*data in fixed columns
*standard character and numeric data - Column
- The default SAS library.
- work
- The two phases that the DATA step is processed in.
- compilation, execution
- SAS creates an imput buffer to h old the current raw data file record that is being processed at ________ time.
- compile
- A ______ _______ _______ holds the current SAS observation during compiling.
- program data vector (PDV)
- During compile time, the _______ portion of the output data set is set up.
- descriptor
- During _____ of the data step, SAS reads in the data through the _____ statement.
- execution, input
- After executing the first observation in the raw data set, SAS does an automatic ______, ____ to SAS data set, and reinitializes the variables in the PDV to _______.
- return, output missing
- True or False: To access a temporary data set, you must use work.dataset.
- false
- To access a permanent data set, submit a _______ statement to assign a libref to the SAS data library and use the libref as the first-level name of the SAS data set.
- libname
- True or False: The LIBNAME statement only needs to be submitted once per SAS session.
- True
-
Formatted input is appropriate for reading:
* data in _____ columns
*standard and nonstandard character and numeric data
*_______ values to be converted to SAS date values - fixed, calendar
-
_______ input is used to read data values by
*moving the input pointer to the starting position of the field
*specifying the variable name
*specifying an _______ - formatted, informat
- ___ moves the pointer n positions
- +n
-
An informat specifies:
* the ____ of the input field
* how to read the data values that are stored in the field - width
- __ indicates a character informat
- $
- For an informat a _____ is a required delimiter.
- period
- Informats: 8. or 8.0 reads __ columns of numeric data
- 8
- Informats: 8.2 reads __ columns of numeric data and my insert a decimal point in the value.
- 8
- $8. reads __ columns of character data and removes leading ______
- 8, blanks
- $CHAR8. reads 8 columns of ______ data adn preserves leading _______.
- character, blanks
- COMMA7. reads __ columns of numeric data and removes selected nonnumeric characters such as _____ _____ and _______.
- 7, dollar signs, commas
- MMDDYY8. reads data in the form _________
- 01/01/60
- SAS uses date informats to ____ and _______ dates to SAS date values
- read, convert
-
SAS detects data errors when:
*the INPUT statement encounters invalid data in a field
*illegal arguments are used in ________
*impossible ___________ operations are requested - functions, mathematical
-
When SAS encounters a data error,
1. a note that describes the error is printed in the SAS ___.
2. the input record being read is displayed in the SAS ___(contents of the in put buffer)
3. the values in the SAS observation being created ar - log, log, log, execution
-
When a variable is created in a DATA step, the
* ______, ______, and ______ are automatically assigned
*remaining attributes such as _____ and ______ are not automatically assigned - name, type, length, label, format
-
For default variable attributes when the variable is used in a later step,
*the ____ is displayed for identification purposes
*its _____ is displayed using a system-determined format. - name, value
-
Use _____ and ______ statements in a
*PROC step to temporarily assign attributes (for the duration of the step only)
*DATA step to permanently assign the attributes (stored in the data set descriptor portion) - label, format
- Use a _______ statement in a PROC step to temporarily override the format stored in teh data set descriptor.
- format
-
You can use the _________ procedure to modify a variable's
*name
*label
*format
*informat - Datasets
-
Proc _______ library =ia;
modify data-set;
label vrariable-1='label';
format variable-1 format-1;
informat variable-1
informat;
run; - Datasets
-
To create a SAS data set using a SAS data set as input, you must use a
*_____ statement to start a DATA step and name the SAS data set being created
*______statement to identify the SAS data set being read - data, set
-
To create a variable, you must use an
________ _________ to add the values of the variables and assign the sum to the new variable. - assignment statement
- True or False: You can use INFILE and INPUT statements to read SAS data sets. They are not only used to read raw data files.
- False
- True or False: You cannot use a SET statement to read raw data files. It can only be used to read SAS data sets.
- True
-
By default, the ____ statement reads all of the
*observations from the input SAS data set
*variables from the input SAS data set - SET
-
Data ______-SAS-data-set;
SET _____-SAS-data-set;
additional SAS statements
Run; - output, input
-
An assignment statement:
*evaluates an __________
*assigns the resulting value to a ________ - expression, variable
-
True or False :
General form of an assignment statement
expression = variable; - False
- An __________ contains operands and operators that from a set of instructions that produce a value.
- expression
-
_________ are:
*variable names
*constants - operands
-
___________ are:
*symbols that request arithmetic calculations
*SAS functions - operators
- A SAS ________ is a routine that returns a value that is determiend from specific arguements.
- function
-
An example of a SAS _______ is
Total = sum(FirstClass,Economy); - function
-
SAS functions:
* perform arithmetic __________
*compute sample _________
*manipulate SAS _______ and process character values
*perform many other tasks - operations, statistics, dates
- True or False: Sample statistics functions ignore missing values.
- True
-
You can use SAS ______ functions to
*create SAS date values
*extract information from SAS date values - date
- SAS date function that obtains the date value from the system clock.
- Today()
- SAS date function that uses numeric month, day, and year, values to return the corresponding SAS date value.
- mdy(month,day,year)
- SAS date function that extracts the year from a SAS date and returns a four-digit value for year.
- year(SAS-date)
- SAS date function that extracts the quarter from a SAS date and returns a number from 1 to 4.
- qtr(SAS-date)
- SAS date function that extracts the month from a SAS date and returns a number from 1 to 12.
- month(SAS-date)
- SAS date function that extracts the day of the week from a SAS date and returns a number from 1 to 7, where 1 represents Sunday, and so on.
- weekday(SAS-date)
- You can use the _____ or ______ statement in a DATA step to control what variables are written to the new SAS data set.
- drop,keep
- True or False: More than one executable statement is allowed on an IF-THEN or ELSE statement.
- false
- You can use the ________ function to convert letters from lowercase to uppercase.
- upcase
- You can use the ___ and ____ statements to execute a group of statements based on a condition.
- do, end
-
IF expression THEN ___;
executable statements
____;
ELSE ___;
_____; - do, end, do, end
- Use ___ and ___ statements to execute a group of statements based on a condition.
- do, end
- True or False: At compile time, the length of a variable is determined the last time the variable is encountered.
- false
- You can use the ______ statement to define the _______ of a variable explicitly.
- length, length
- length City __ 11;
- $
-
In a Data step, you can subset the rows (obs) in a SAS data set with a
*W_____ statement
*D_____ statement
*subsetting I_ statment - where, delete, if
- The ______ statment in a data step is the same as the ______ statment in a PROC step.
- where, where
- You can use a ______ statement to control which rows are written to the SAS data set.
- delete
- If expression then D______;
- delete
-
You can use a subsetting __ statment to control which rows are written to the SAS data set.
____ expression; - if, if
- True or False: The subsetting IF statement is valid only in a DATA step.
- True
- The constant '_________'d creates a SAS date value from the date enclosed in quotes.
- ddMMMyyyy
-
__ is a one- or two-digit value for the day.
___ is a three-letter abbrev. for the month
____ is a two- or four-digit value for the year.
_ is required to convert the quoted string to a SAS date. - dd, MMM, yyyy, d
- True or False: You cannot use the $UPCASE informat in the INPUT statement to translate the values of a variable to uppercase as they are read from the raw data file.
- False
- You can use a ______ or ______ data set option in a DATA statement to control what variables are written to the new SAS data set
- drop=, keep=
- Use the SET statement in a DATA step to __________ data sets.
- concatenate
- True or False: You can only read one SAS data set with a single SET statment.
- False
- You can use a _______ data set option to change the name of a variable.
- rename=
- True or False: drop=, keep=, rename= all need parentheses around them in the data set option.
- True
- Use the SET statement with a ___ statement in a Data step to interleave SAS data sets.
- by
- _________ SAS data sets simply concatenates SAS data sets so the observations in the resulting data set are in order.
- Interleaving
- In the case wehre the data values are equal, the observation is always read from the _____ dtat set listed in the SET statement.
- first
- Before interleaving data sets, you can use Proc _______ to see if they have already been sorted.
- contents
- Use the _____ statement in a DATA step to join corresponding observations from two or more SAS data sets using a common ___ variable.
- merge, by
- True or False: You can read any number of SAS data sets with a single MERGE statement.
- true
- Merging combines data sets ________ by a common variable.
- horizontally
- SAS reinitializes variables created in the DATA step to _____ at the start of every DATA step iteration when merging data sets.
- missing
- Use the ____ data set option to determine which data set(s) contribute to the current observation.
- in=
-
SAS-data-set(IN=variable)
variable is a temproary numeric variable that has two possible values: ___ or ___ - 0, 1
- True or False: The variable created with the IN= data set option is available during execution and is written to the SAS data set.
- false
- The subsetting IF controls what observations are written to the SAS data set. If the condition evaluates to _____, the observation is written to the SAS data set. If the condition is evaluated to _____, the observation is not written to the SAS data set.
- true, false
- A merge where unique BY values are in one data set and duplicate matching BY values are in the other data set.
- one-to-many
- A merge where duplicate matching BY values are in both data sets.
- many-to-many
- Summary Report Procedure that produces frequency counts.
- proc freq
- Summary Report Procedure that produces simple statistics
- proc means
- Summary Report Procedure that produces flexible detail and summary reports
- proc report
- Summary Report Procedure that produces flexible summary reports
- proc tabulate
- PROC ____ displays frequency counts of the data values in a SAS data set.
- freq
-
By default, PROC FREQ
*________ every variable in the SAS data set
*displays each distinct ____ value
*_______ the number of observations inwhich each data value appears
*indicates for each variable how many observations have ______ v - analyzes, data, calculates, missing
- For each variable, PROC FREQ displays every unique value, counts how many observations have each value, and provides percentages and _________ statistics.
- cumulative
- True or False: You do not create frequency reports for variables with a large number of distinct values. You usually only create them for categorial variables .
- true
- Use the _______ statement in PROC FREQ to limit the variables included in the frequency counts. These are typically variables that have a limited number of distinct values.
- tables
- Use the ________ option in the PROC FREQ statement to display the number of levels for the variables included in the frequency counts.
- nlevels
-
To display number of levels without freq counts:
proc freq data=ia.crew nlevels;
tables JobCode Location / ______;
run; - noprint
-
To display the number of levels for all vars without displaying any freq counts
proc freq data=ia.crew nlevels;
tables ____ /noprint;
run; - _all_
- PROC FREQ automatically groups the data by a variable's formatted value if a _______ is associated with that variable.
- format
- A two-way, or _________, frequency report analyzes all possible combinations of the distinct values of two variables.
- crosstabular
- In a crosstabular frequency report, the ________ operator in the TABLES statement is used to cross variables.
- asterisk
- In a crosstabular report, the values of the first variable in the TABLES statement form the _____ of the freq table and the values of the second variable form the ______.
- rows, columns
-
To display the crosstabulation results in a listing form:
proc freq data=ia.crew;
tables JobCode*Location /
______;
run; - crosslist
- The _____ procedure displays simple descriptive statistics for teh numeric variables in the SAS data set.
- means
-
By default, PROC MEANS
*analyzes every _______ variable in the SAS data set
*prints the statistics __, _____, ___, ___, ____
*excludes missing values before calculating statistics - numeric, N, mean, std, min, max
-
Other statistics in PROC MEANS include
Range
Median
Sum
______ (number of rows of missing values) - NMISS
- The ___ statement restricts the variables processed by PROC MEANS.
- var
- The _____ statement in the MEANS procedure groups the observations of the SAS data set for analysis.
- class
- The _______ option controls the number of decimal places displayed in the output.
- maxdec=
-
To supress the printing of the cumulative freqs and cumulative percentages use:
proc freq data=ia.sanfran;
tables Destination
/_______;
title 'FLights from
San Francisco';
run; - nocum
-
PROC ______ enables you to:
* create listing reports
* create summary reports
* enhance reports
* request separate subtotals and grand totals
*generate reports in an interactive point-and-click or programming environments - report
- In PROC REPORT, use the ____ displays the report in the OUTPUT window.
- nowd
-
The default listing for the report procedure displays:
*each data value as it is stored in the data set, or formatted value if a format is stored with the data
*variable names or labels as report column headings
*a default width for - left, right
-
You can use a _______ statement to
*select the variables to appear in the report
*order the variables in the report - column
-
You can enhance the report by using ______ statements to:
*define how each variable is used in the report
*assign formats to variables
*specify report column headers and column widths
*change the order of the rows in the report - define
- True or False: You can define options in the DEFINE statement in any order.
- true
-
For the define statement in the report procedure, the ________ usage for numeric variables:
*uses a defualt statistics of SUM
*has no effect when producing a listing report that contains character variables, so the original data value is displa - analysis
- In define statement for the report procedure, the character variable type produces a _______ report and _______ usage type as the default.
- listing, display
- In the define statement of the report procedure, if there is a ______ stored in the descriptor portion of the data set, it is the default header.
- label
- In the define statement of PROC REPORT, ______ assigns a format to a variable and _______ controls the width of a report column.
- format=, width=
-
________ orders the rows in the report from the REPORT procedure.
Orders the report in _______ order. Include the _________ option in the DEFINE statement to force the order to be that.
*Suppresses repetitious printing of values.
*Do - order, ascending, sorted
-
Use the REPORT procedure to create a summary report by defining variables as ________ variables.
These variables that have the same values are collapsed into a single ____ in the report. - group, row
-
For PROC REPORT you can define more than one variable as a ______ variable.
Nesting of group variables is determined by the order of the variables in the ________ statement. - group, column
-
If you have a group variable, there must be no _______ or _____ variables.
*Group variables produce _______ reports.
*_______ and _______ variables produce ________ reports - display, order, summary, display, order, listing
-
Default usage for numeric variables is ______ with a default statistics of ______.
*If the report contains _____ variables, the report displays the sum of the numeric variables' values for each group.
*If the report contains at least one - analysis, sum, group, display, order, numeric
- In defining analysis variables in the report procedure, to specify a statistic other than SUM, type the name of the statistic after the slash in the _____ statement.
- define
-
You can use an _______ statement to add
* grand total to the top or bottom of the report
* line before the grand total
* line after the grand total - rbreak