1.2 Flashcards

1
Q

Which of the following is NOT an example of structured data?

a) SAS tables
b) MS Access tables
c) comma-delimited files
d) Oracle DBMS tables

A

c) comma-delimited files are unstructured

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

True/False - JSON files are examples of unstructured data.

A

True - JSON files, text files, comma-delimited files, and weblogs are all examples of unstructured data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

True/False - you can analyze and report on unstructured data in SAS.

A

False - you must import unstructured data into SAS before analyzing and reporting on it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which of the following is true regarding SAS tables?

a) the file extension is .sasbdat
b) there are two parts to a SAS table - a descriptor portion and a data portion
c) the data portion contains columns names
d) the descriptor portion contains data values

A

b) there are two parts to a SAS table - a descriptor portion and a data portion

a - the file extension is .sas7bdat
c & d - The descriptor portion contains the metadata, or the properties of the table, such as the name, the number of rows, and the date and time the table was created. The descriptor portion also includes column names and attributes. The data portion contains the data values, stored in columns.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which of the following is NOT a required attribute of a SAS column:

a) a label
b) a name
c) a type
d) a length

A

a) a label

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

True/False - SAS column names can be 1 to 36 characters long.

A

False - SAS columns names can be 1 to 32 characters long.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

True/False - SAS column names must start with a letter or underscore.

A

True - SAS column names must start with a letter or underscore.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

True/False - SAS columns are stored in uppercase by default.

A

False - Column names are stored in the case that you use when you create the column and can be in uppercase, lowercase, or mixed case.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

True/False - Special symbols and spaces cannot be used in SAS column names.

A

False - Depending on the environment you use to submit your code, SAS might allow for spaces and special symbols other than underscores in column and table names. If you use data sources other than SAS that have flexible column name rules, SAS can make allowances for that, however, it’s recommended to follow the SAS naming conventions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which of the following are SAS column attribute Types:

a) numeric
b) character
c) date
d) a & b
e) a, b & c

A

d) numeric and character (SAS dates are a particular kind of numeric value).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which of the following statements are true?

a) numeric columns can only store numeric values, which can include the digits 0 through 9, a minus sign, and a single decimal point.
b) Character columns can store only letters
c) Character columns store SAS dates
d) Character columns can store, letters, numbers, special characters and blanks.

A

d) Character columns can store, letters, numbers, special characters and blanks.

a - numeric columns can only store numeric values, which can include the digits 0 through 9, a minus sign, and a single decimal point. Can also hold E for scientific notation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which of the following is NOT true regarding SAS dates?

a) SAS stores date values as the number of days between January 1, 1960 and a specific date.
b) Dates before January 1, 1960 are stored as negative values.
c) You must use special functions to accommodate leap years when programming SAS.
d) There are numerous ways to display numeric date values so they look like dates you can understand.

A

c) You must use special functions to accommodate leap years when programming SAS.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which column names below follow SAS naming conventions (select all that apply)?

a) month6
b) 6month
c) month#6
d) month 6
e) month_6
f) Month6

A

a) month6, e) month_6, and f) Month6

According to SAS naming conventions, column names cannot start with a number and cannot include blanks or special characters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which of the following is true regarding the PROC CONTENTS procedure?

a) It generates a report of the data portion of the table.
b) It provides summary statistics for numeric variables by default
c) It gives general information about the table, including where the table is stored, when it was created and modified, and the number of rows and columns.
d) It produces a table called “Alphabetic List of Variables and Attributes”
e) c & d

A

e) c & d

a - It generates a report of the descriptor portion of the table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

True/False - The following code will run without error.

proc contents data=”s:/workshop/data/class.sas7bdat”;
run;

A

True - assuming the class.sas7bdat exists in the directory listed. However, this hardcoding of the filepath is not recommended.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which two pieces of information, necessary for reading SAS data, can you specify with a LIBNAME statement?

a) format and path
b) server and directory
c) engine and location
d) location and file type

A

d) location and file type

17
Q

Which of the following is correct syntax for assigning a library?

a) LIBNAME libref engine “path”;
b) LIBNAME engine libref;
c) LIBNAME libref “path”;
d) LIBNAME name engine “path”;

A

a) LIBNAME libref engine “path”;

c - base is the default engine and is not necessary if the tables to be read are SAS tables, however, if they are not SAS tables the engine must be specified

18
Q

Which of the following are true regarding the libref portion of the LIBNAME statement?

a) The libref is the name of the library.
b) The libref must be eight characters or less.
c) The libref must start with a number
d) The libref can include only letters, numbers, and underscores in the name.
e) a, b, and d

A

e) a, b and d

c - the libref statement must start with either a letter or underscore

19
Q

How many characters can a libref be in length?

a) 1 to 32
b) 1 to 36
c) 1 to 8
d) unlimited

A

c) 1 to 8

20
Q

True/False - When creating a library, you must specify a path that is relative to where SAS is running.

A

True - If SAS is on your local computer, you can specify a path to a folder on your computer. If SAS is on a remote server, the path or folder must be to a location relative to the server.

21
Q

True/False - Once you create a SAS library in a program, it is permanent.

A

False - By default, a library, or libref, that you define remains active until you delete it or end your SAS session. When you restart SAS, you simply submit the LIBNAME statement again and then you can access your data.

22
Q

Which of the following is NOT true regarding SAS libraries?

a) SAS automatically creates a Work library
b) SAS automatically defines the SASHELP library
c) The Work library will permanently save the tables you create in you program.
d) The Work library is the default library. If you don’t type a libref in front of a table name, SAS uses the Work library.

A

c) The Work library is temporary - tables written to the Work library are deleted at the end of each SAS Session.

23
Q

Which of the following is correct syntax for using a library to read Excel files?

a) libname xlsx xlclass “s:/workshop/data/class.xlsx”;
b) libname xlclass xlsx “s:/workshop/data/class.xlsx”;
c) libname xlclass “s:/workshop/data/class.xlsx”;
d) libname xlclass xlsx “s:/workshop/data/class”;

A

b) libname xlclass xlsx “s:/workshop/data/class.xlsx”;

24
Q

True/False - The Excel files in a directory is can be through of as a collection of tables.

A

False - Each Excel workbook must be assigned to a library and each individual worksheet is one table in the library.

25
Q

What does the statement below do?

OPTIONS VALIDVARNAME=V7;

a) Forces column names in Excel data to adhere to SAS naming conventions.
b) Replaces any special symbols or spaces in Excel column names with underscores.
c) Truncates names greater than 32 characters.
d) all of the above

A

d) all of the above

26
Q

Which of the following statements will clear the xlclass library?

a) libname clear;
b) libname xlclass clear;
c) clear libname xlclass;
d) options clear xlclass;

A

b) libname xlclass clear;

27
Q

True/False - The following syntax will run without error.

proc import data=”FILEPATH/storm_damage.csv”
dbms=csv out=storm_damage_import replace;
run;

A

False - The PROC IMPORT procedure uses DATAFILE= not DATA=

28
Q

What should be added to the PROC IMPORT procedure to read the ‘class_test’ worksheet from the Excel file?

proc import datafile=”s:/workshop/data/class.xlsx”
dbmx=xlsx
out=work.class_test_import replace;
run;

a) Add the following option to the proc import statement: sheet = class_test
b) Add the following statement after the proc import statement: sheet = class_test;
c) Add the following option to the proc import statement:
sheet = 2
d) Add the following statement after the proc import statement: sheet = class_test.xlsx;

A

b) Add the following statement after the proc import statement: sheet = class_test;

proc import datafile=”s:/workshop/data/class.xlsx”
dbmx=xlsx
out=work.class_test_import replace;
sheet = class_test;
run;

29
Q

True/False - Using PROC IMPORT to read an Excel file is the same as creating the XLSX library engine.

A

False - The XLSX libname engine reads data directly from the Excel file, so programs that reference the Excel library will always use the current data. PROC IMPORT creates a copy of the Excel file that is a snapshot in time until the IMPORT step runs again.

30
Q

What is the default length of a numeric column in SAS?

a) 4 bytes
b) 8 bytes
c) 32,767 bytes
d) It doesn’t have a default length

A

b) 8 bytes

All numeric columns in SAS are 8 bytes by default.

31
Q

Which LIBNAME statement has the correct syntax?

a) libname reports “filepath/workshop”;
b) libname orion filepath/workshop;
c) libname 3456a “filepath/workshop”;

A

a) libname reports “filepath/workshop”;

The libref must start with a letter or an underscore and contain eight characters maximum. The path must also be in quotation marks.

32
Q

Which of the following tables is available at the beginning of a new SAS session?

a) sales
b) work.newsalesemps
c) sashelp.class

A

c) sashelp.class

The SASHELP library contains sample and resource tables provide by SAS. The library is automatically available when SAS starts.

33
Q

Missing numeric values are represented in a SAS table with a:

a) .
b) blank
c) n/a
d) *

A

a) .

Missing numeric values are represented with a period.

34
Q

Which statement about SAS dates is false?

a) A SAS date is one of three SAS column types: numeric, character, and date
b) SAS dates represent the number of days from January 1, 1960
c) SAS date values can be positive or negative
d) SAS date values can be used in calculations

A

a) SAS date values are numeric values that represent the number of days before or after January 1, 1960

35
Q

Which LIBNAME statement has the correct syntax for reading a Microsoft Excel file?

a) libname excel “filepath/myexcelfile”;
b) libname mydata xlsx “filepath/myexcelfile”;
c) libname mydata xlsx “filepath/field_data.xlsx”;

A

c) libname mydata xlsx “filepath/field_data.xlsx”;

After the libref, the XLSX engine is specified. The full path to the Excel file, including the .xlsx extension must be provided in quotation marks.

36
Q

Which library name (libref) is valid?

a) 2010Car
b) car/2010
c) car2010
d) cars_2010

A

c) car2010

A libref must have a length of one to eight characters, and must begin with a letter or underscore. The remaining characters must be letters, numbers, or underscores.

37
Q

True/False - To disassociate a libref that you previously assigned, you can use the UNASSIGN option in the LIBNAME statement.

A

False - Use the CLEAR option in the LIBNAME statement to disassociate an assigned libref.

38
Q

What does this code do?

proc import datafile=”d:/collect817/bird_count.csv”
dbms=csv out=bird817 replace;
run;

a) It creates a SAS data set named bird817 in the work library from the CSV file bird_count and replaces bird817 whenever the CSV is updated.
b) It creates a SAS data set name bird817 in the work library from the CSV file bird_count.
c) It uses the CSV engine to directly read the data file bird_count.csv

A

b) It creates a SAS data set name bird817 in the work library from the CSV file bird_count.

This PROC IMPORT step creates a SAS data set from a CSV file. When the code runs, it replaces the SAS data set if it already exists.

39
Q

In which portion of the SAS data set are the following found?

  • name of the data set
  • type of the column
  • creation date of the data set

a) descriptor portion
b) data portion

A

a) descriptor portion

The descriptor portion of the SAS table includes the table metadata