SAS Flashcards
what do we call statements that begin/end a step?
step boundaries e.g. run;
what are global statements?
impact the entire SAS session and set options/values that will remain in effect until they are changed or the session ends e.g. title, options, libname, footnote
how can you comment?
- in front of the line to comment one line
/* comment */ for any length of text
what are the 3 required attributes of a structured SAS column?
name (1-32ch, must start with letter/underscore), length (default numeric=8bytes/16digits, default char=length of column name, can be up to 32767bytes), type (char/numeric)
how do you create/use a macrovariable?
use %LET statement to define macrovariable. WIthin code can then use & to refer to it.
e.g. %LET path = xyz
…&path
SAS will automatically replace path with xyz
macrovariables must have double quotations
when defining a library, what is the method?
LIBNAME libname DATATYPE path libname must be <=8 characters.
Which procedure produces a report about the descriptor portion of a table?
PROC CONTENTS
what are rows and columns also called?
observations and variables
Which statement can be used to subset the rows read in a PROC step?
WHERE
Which procedure lists the distinct values for one or more columns?
PROC FREQ
If you want to format just numeric or character types of columns, what keyword would you use?
format NUMERIC fmt;
format CHARACTER fmt;
for all columns use ALL
describe the PROC MEANS step
generates simple summary statistics for each numeric column in input data by default unless VAR statement used
in the PROC MEANS step, what does CLASS, WAYS, OUTPUT and OUT do?
CLASS - specifies columns to group by before calculating statistics
WAYS - specifies the number of ways to make unique combinations of class variables
OUTPUT - provides the option to create an output table with specific output statistics
OUT= - names output table to be created
describe the PROC FREQ step
creates a frequency table for each variable in the input table by default. Can specify variables to be analysed using TABLES statement
how do you import structured/unstructured data?
structured e.g. xlsx use LIBNAME or PROC IMPORT
unstructured e.g. CSV use PROC IMPORT
in the PROC SORT step, what does NODUPKEY, DUPOUT do?
NODUPKEY keeps the first row for each unique value of the columns listed in the by statement
DUPOUT creates an output table containing duplicates