SAS - Base Examination Preparation

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What are the two types of column pointer controls?

+N and @N. @N column pointer control simply moves the input pointer to the column n. +N pointer control moves the input pointer by n columns from the current position. For instance, Names is 1-11, then the pointer moves from 12th to the 14th position to read in the DOB column.

What is the descriptor portion of the data set?

- Contains information about the data set such as the number of observations, the size of the data set, the list of variables and so forth.

How would you create a custom format using the Format procedure?

- Define the format and then use format in data step. Proc format; Value ques 0 = "Disagree" 1 = "Neutral" 2 = "Agree"; run; Data survey2; Set survey; format q1 q2 q3 ques.; run;

What is the SELECT - WHEN Statement? Where does it go and what does each component (SELECT, WHEN) mean?

- SELECT: Selects a variable. - WHEN: Evaluates whether the selected variable contains a value specified. -

What is the input buffer?

- The area where the data passes through before being written to the data set. - When reading raw data from an external source, the data is temporarily read into the input buffer before being read into the PDV. ​Input buffer is a logical area in memory into which SAS reads each record of raw data when SAS executes an INPUT statement. Note that this buffer is created only when the DATA step reads raw data. (When the DATA step reads a SAS data set, SAS reads the data directly into the program data vector.)

What does mmddyy8. look like?

01/31/89, 12-25-87

Three things to remember when SAS encounters a data error

1. A missing value is assigned to the variable. 2. A message is written to the SAS log explaining the error. 3. The data step continues to execute

What happens after the code has no syntax errors? (3 steps)

1. Creates three parts that are necessary to build the data sets. Input Buffer, Program Data Vector, Descriptor Portion of the Data Set.

What happens when SAS encounters a syntax error?

1. SAS writes an error message to the SAS log explaining the error. 2. The data step stops executing 3. No data set is created

What are the two purposes of informat?

1. To import character values longer than 8 characters 2. To import non-standard data values such as date, time, and dollar amount.

What does this output? Data DS; a = 1; a = 2; output; Run;

1.) Assigns the numeric value 1 to the variable a in the PDV. 2.) Then the value 1 is immediately overwritten by the numeric value 2. 3.) The implicit OUTPUT statement then writes the value (2) to the data set. 4.) The value 1 is overwriten and it never shows up in the data set.

What does the following code accomplish? Data Male Female; Set SASHelp.class; If sex = "M" then output Male; Else if sex = "F" then output Female; Run;

1.) It creates two data sets: Male and Female 2.) Because of the IF statement, the MALE data set contains only the male students. 3.) Because of the ELSE IF statement, the FEMALE dataset only contains female students.

What happens when the following code is entered: Col7 John 30 20 Mary 25 35 Amy 22 33 Ken 40 50 Filename FN '/folders/myfolders/text/col7.txt'; Data DS; Infile FN firstobs=2; Input Name $ 1-4; If Name = "Amy" then input id 7-8; Else input id 10-11; Run;

1.) It reads the first line "Input Name $1-4" So the first cell will have John. 2. ) Then it moves to the next statement, if Name = "Amy" then input id 7-8; else input iD 10-11. Therefore, it will enter 35 in the next cell to the right. That concludes one iteration. Note, two records are read during this iteration. 3.) Then the input pointer moves to the third record, and reads the name Amy. The pointer moves again to the next line in the 4th record. In this third iteration, the name in the PDV is "Amy" so SAS reads the ID from position 7-8 based on the if-then statement. Therefore, 40 is entered.

What are the three parts of formatted input?

1.) The column pointer control; the column pointer control moves the input pointer to the position specified. '@14' is a column pointer control. It tells SAS to move to the input pointer to position 14. Filename FN '/folders/myfolders/text/col3.txt'; Data DS; Infile FN firstobs=2; Input Name $ 1-11 @14 DOB date9.; Run; 2. The variable to be created After the column pointer control, the new variable must be created. 'DOB' in our example. 3. The informat to be assigned to the variable. Now, it will convert the values into the numeric date representation.

What are the different tables in the descriptor portion of the data set?

1.) The first table contains information about the data set name, member type, creation date and so forth 2.) Number of observations and variables in the data set. Also displays whether data is sorted or indexed. 3.) Information about engine/host 4.) Lists the variables in the data set.

What does weekdate. do?

11001 --> ​Tuesday, February 13, 1990

When using TRANWRD what is the length of variable?

200

How do you exponentiation?

3**3 = 3^3

What is the length of the variable Name? Data Student1; Name = "Amber"; Run; Data Student2; Name = "Timothy"; Run; Data Students; Set Student1 Student2; Run;

5

A user-defined format has been created using the FORMAT procedure.How is it stored? A. in a SAS catalog B. in a memory resident lookup table C. in a SAS dataset in the WORK library D. in a SAS dataset in a permanent SAS data library

A - In a SAS catalog

When is a colon modifier needed?

A colon (:) is needed to assign the informat to the variable in List input

How do you remove title and footnotes from previous charts?

Add title and footnote above the code with nothing else. title; footnote; Proc Print Data=sashelp.cars; var make msrp; where make = "Hyundai"; Run;

What happens when there are multiple input statements?

After the first input statement, the input pointer automatically moves to the next line. It is now placed at the beginning of the third record before the value "Edward". Then in the PDV, it sees that it matches "Mary" in the iteration and proceeds to read data for the AGE and GENDER column. However, because of the position of the input pointer (remember pointer is now on the third row) it tries to read Edward as Age and 49 as gender. To resolve this, you would add @ in the first INPUT statement.

Why is RETAIN more efficient than the assignment statement? Data Temp2; set Temp; Retain City 'Beverly Hills'; State='California'; Run;

Although both the assignment statement and the RETAIN statement achieve the same result, the RETAIN statement is more efficient. With the RETAIN statement, the value 'Beverly Hills' is assigned to the CITY variable only once in the very first data step iteration. The value is then retained for the rest of the observations. The assignment statement, on the other hand, assigns the value 'California' to the variable in each data step iteration. In total, the value is assigned to the variable five times in this example.

Given the SAS data set WORK.ONE: X Y Z 1 A 27 1 A 33 1 B 45 2 A 52 2 B 69 3 B 70 4 A 82 4 C 91 The following SAS program is submitted: data WORK.TWO; set WORK.ONE; by X Y; if First.Y; run; proc print data=WORK.TWO noobs; run; Which report is produced? A. X Y Z 1 B 45 2 A 52 2 B 69 3 B 70 4 A 82 4 C 91 B. X Y Z 1 A 27 1 B 45 2 A 52 2 B 69 3 B 70 4 A 82 4 C 91 C. X Y Z 1 A 33 1 B 45 2 A 52 2 B 69 3 B 70 4 A 82 4 C 91 D. The PRINT procedure fails because the data set WORK.TWO is not created in the DATA step.

B

Which of the following permanently associates a format with a variable? a. the FORMAT procedure b. a FORMAT statement in a DATA step c. an INPUT function with format modifiers d. an INPUT statement with formatted style input

B

Why is Program data vector important?

Because this is where SAS builds the dataset

Where should Length statement be placed?

Before the INPUT statement

What does the following code do? Data Class; set sashelp.class; Run; Data Baseball; set sashelp.baseball; Run; Data fish; set sashelp.fish; Run; Proc Contents Data=work._all_; Run; What does it list out?

By using _all_, you can print the content details for all three data sets in the Work library. It lists out: 1.) The data sets and data files in the Work library. 2.) The descriptor portion of every data set in the Work library.

The following program is submitted: proc format; value salfmt. 0 -< 50000 = 'Less than 50K' 50000 - high = '50K or Greater'; options fmterr nodate pageno=1; title 'Employee Report'; proc print data=work.employees noobs; var fullname salary hiredate; format salary salfmt. hiredate date9.; label fullname='Name of Employee' salary='Annual Salary' hiredate='Date of Hire'; run; Why does the program fail? A. The PAGENO option is invalid in the OPTIONS statement. B. The RUN statement is missing after the FORMAT procedure. C. The format name contains a period in the VALUE statement. D. The LABEL option is missing from the PROC PRINT statement.

C The format name (salfmt.) contains a period in the VALUE statement. This is a syntax error that will cause the program to fail. When defining custom formats, the name of formats cannot end in a number or a period. The name, 'salfmt.', in VALUE statement is invalid. However, when you refer to the custom format, the ending period is necessary.

The following SAS program is submitted: proc format; value score 1 - 50 = 'Fail' 51 - 100 = 'Pass'; run; proc report data = work.courses nowd; column exam; define exam / display format = score.; run; The variable EXAM has a value of 50.5. How will the EXAM variable value be displayed in the REPORT procedure output? A. Fail B. Pass C. 50.5 D. . (missing numeric value)

C The value 50.5 is not defined in the FORMAT definition. It will be displayed without changes. Note: the REPORT procedure is used to display data in the output. This will be explained in later modules.

Default Character and Numeric Value Length

Character values longer than 8 characters will get truncated. However, numeric values longer than 8 digits will be displayed in full.

; B. proc contents data = sasuser.all; run; C. proc contents lib = sasuser._alI_; run; D. proc contents data = sasuser._all_; run;

D

Given the SAS data sets EMPLOYEE and SALARY: EMPLOYEE SALARY Fname age name salary Bruce 30 Bruce 25000 Dan 40 Bruce 35000 Dan 25000 The following SAS program is submitted: data work.empdata; <insert MERGE statement here> by fname; totsal + salary; run; Which MERGE statement correctly completes the program? A. merge employee salary rename = fname = name; B. merge employee salary rename(name = fname); C. merge employee salary (rename = (fname = name)); D. merge employee salary (rename = (name = fname));

D

Which format is needed to display the dollar amount. For instance: 110100 --> $110,000.00

Data DS2; Set ds; Format num2 dollar11.2; Run;

What is an implicit OUTPUT statement?

Data DS; a = 1; Run; That code is the same as Data DS; a = 1; output; Run; First, the numeric value is assigned to the variable a in the PDV. Then OUTPUT tells SAS to write the observation to the dataset.

What is the mdy function and what are the parameters in the function?

Data Rev; Var1 = mdy(1, 15, 1960); Run;

What is an assignment statement? In relation to variable length? What is an example?

Data Shops; Brand = "Reebok"; Run; It sets the variable Brand to 6 characters because Reebok is 6 characters.

What sequence of code would you use to export the data to an external text file?

Data _null_; Set Profile; File '/folders/myfolders/output1.txt'; Put Name Age; Run; The file statement tells SAS to export the data into an external text file.

Execution Phase

Data set is created; read data into input buffer, read data from input buffer to PDV, write data from PDV to data set one observation at a time, repeat the process until all observations are written in the dataset.

What does this statement do? Data DS; a = 1; output; a = 2; output; Run;

Each output statement tells SAS to write the value to the data set immediately after it is assigned to the variable in the PDV.

What does filename do and where should it be placed?

Filename statement is the statement above the data step. It replaces the line "Infile '/folders/myfolders/text/list1.txt';" ex. Filename FN '/folders/myfolders/text/list1.txt'; Data Number; Infile FN; Input Num1 Num2; Run; In the example, FN is the fileref that was created.

What are the four sets of statistics that are formed in cross tabulation tables in PROC freq?

Frequency, Percentage, Row Pct, Col Pct. You can use Norow no col to remove row and column percentage. Proc freq data=sashelp.class; Table sex*age / norow nocol; Run;

What is the difference between GE and GT?

GE = Greater than or equal to, GT = Greater than

What is the difference between CATX and CAT?

In addition to concatenating values, the CATX function: Removes all of the leading and trailing spaces from all of the variables Inserts a delimiter to separate each of the values Data Name2; Set Name; Full = Catx(', ', first, last); Run; E.g. FIRST: Sue LAST: Chan FULL: Sue, Chan

What will be the output for the following code: Data Male; Set sashelp.class; sex2 = sex; where sex2 = "M"; Run;

In this example, the SEX2 variable is newly created in the MALE data set. It does not exist in the CLASS data set from the SASHelp library. Using the WHERE statement on the SEX2 variable will result in an error. ERROR: Variable sex2 is not on file SASHELP.CLASS. When having to subset a data set using a newly created variable, you must use the IF statement.

What does the truncover option do and where does it go?

Infile statement; It prevents SAS from going to the next line when it reaches the end of the record.

What does mmddyy10. look like?

Informat: mmddyy10. Values: 12-31-2010

What does yymmdd10. look like?

Informat: yymmdd10. Values: 2010/12/31

What is the function of the (IN = ) option?

It allows you to identify the mismatched observations between the two data sets.

What does the following code accomplish? options pageno = 5; Proc print data=sashelp.cars; Run;

It allows you to specify the starting page number of the output. For this problem, the starting page number is set to 5.

What does VARNUM option do?

It can be added to the CONTENTS procedure to display the variables in the order they were created

Where should the DLM = ',' be placed and what does it do? (In exporting files)

It changes the delimiter from a space to a comma in the exported data file. It is used in the file statement as opposed to the PUT statement. Data _null_; Set Profile; File '/folders/myfolders/output1.txt' termstr=CRLF DLM=','; Put Name Age; Run;

What cases the _error_ variable in PDV to change from 0 to 1

It changes when SAS encounters a data error. Even though _error_ variable is not written to the data set, it can be used in a SAS statement or expression. ex. Data Profile; Input Name $ Age; If _error_ = 1; Datalines; Khan 28 Natalia 32 Tommy xx Lee 34 ; Run;

What is the CAT function?

It concatenates character values. Below is an example: Data Name2; Set Name; Full = Cat(first, last); Run; E.g. FIRST: Sue LAST: Chan FULL: Sue Chan

What is the descriptor portion of the dataset?

It contains the details of the data set as the number of observations, variables, data set size, and so forth.

What is the function of the INPUT function? Data Month; date = '13mar2000'; date2 = input(date, date9.); Run;

It converts a character variable to a numeric variable. It will ouput the SAS date numeric value of 14682

What does the PUT function do?

It converts a numeric variable to a character variable Data Month; date = '13mar2000'd; date2 = put(date, ddmmyy10.); Run;

What does END = eof option mean?

It creates a variable in the PDV called EOF. The EOF variable can be used in the IF statement to only keep the last record in the data set. Filename FN '/folders/myfolders/text/list7.txt'; Data DS; Infile FN DLM=',' END=eof; Input Name $ Age Gender $; If eof = 1; Run; Good if eof = 1; Bad if end = 1;

What does the following code accomplish? Data DS1 DS2; Set SASHelp.class; Run;

It creates multiple data sets within a single data step in SAS.

What does the PRINT procedure include and what does it not include?

It displays only the data portion of the dataset. The descriptor portion of the data set can be displayed using the CONTENTS procedure.

What is the DATASETS procedure?

It displays similar results as the CONTENTS procedure Prints out the list of data sets in the library as well as the descriptor portion of the class data set.

What is the missover option and where does it go?

It goes in the infile statement; and it prevents SAS from going to th enext line when it reaches the end of the current record.

What does the modifier i in the find function do?

It ignores whether it is uppercase or lowercase. Data one; Text='Australia, US, Denmark'; Pos=find(Text,'US', 'i'); run;

What is the variable length of Name below? Data Student1; Name = "Amber"; Run; Data Student_all; Length Name $ 8; Set Student1; Run;

It is 8 characters long.

What is the function of TRANWRD?

It is a find and replace function. It replaces a character value with another. data one; add = '214 London Way'; add2 = tranwrd(add, 'Way', 'Drive'); run;

What is the length of the variable created by the INPUT function?

It is always a length of eight, regardless of the value it contains

What does the _ mean in the following code: Data Students; Set sashelp.class; where name like 'Jan_'; Run;

It is another wildcard you can use with the like operator. _ can only be used for a single character only. For instance, it can only work for Jane but not Janet as this would be two letters from Jan, instead of 1.

When is the input buffer created?

It is only created when the data comes from external sources. If the data come from a SAS data set, the data goes straight to the program data vector.

What is an input pointer?

It is placed at the beginning of the input buffer and reads the data into the PDV. Then the data read into the PDV becomes the variables values. They are written to the data set.

Data Shops; Brand = "Reebok"; Brand = "Nike"; Brand = "Timberland"; Run; What is the length of Brand?

It is still 6, because the length of the variable follows the very first value assigned to the variable. Therefore, when you output the data set. It would say Timber.

What is the function of 'DLM = ','' and where should it be placed?

It is to read data correctly by a specific delimiter. It should added as an option to the INFILE statement.

What is the purpose of the FSLIST procedure?

It is used to display the contents of an external file within a SAS session

What does the QTR() function do?

It is used to find out which quarter the data falls into

What is the library reference (libref)?

It is used when referencing a permanent data set data vehicle; set libref.dataset; run;

How does CONTENTS procedure display the list of variables in the data set?

It lists it in alphabetical order

What does Data _null_ do?

It prevents the data step from creating an actual data set.

What does the following code do? options nonumber; Proc print data=sashelp.cars; Run;

It prevents the page number from being displayed on the output.

Without the File statement, what does the Put statement do?

It prints the data to the SAS log.

What is the difference between formatted input and column input?

It reads data that is aligned in fixed positions AND it allows informat to be assigned to the variables. Filename FN '/folders/myfolders/text/col3.txt'; Data DS; Infile FN firstobs=2; Input Name $ 1-11 @14 DOB date9.; Run;

What does the TRIM function do in SAS?

It removes the trailing spaces from the JC variable when concatenating the variables.

what does the following code accomplish: Data Class; Set SASHelp.class (rename=(sex=gender height=hgt weight=wgt)); Run;

It renames more than one variable in the data step.

What does the following code do? Data Func; WD = Weekday('01JAN2014'd); Run;

It returns 4 as it is a Wednesday. Saturday is the 7th day.

What does the today() function output in SAS?

It returns the SAS date constant for the current date. Assume that today is April 25, 2000. It will return the value 14725.

What does the SCAN function do in SAS?

It scans and returns the nth word from the character value. data Test; Title = 'A Tale of Two Cities, Charles J. Dickens'; Word = scan(title, 3); run; It will return Of

What does the FIND function do?

It searches for text in a character variable and returns its position if it is found IT IS CASE SENSITIVE

When using column input and the variable is a character, where should the $ be placed?

It should be placed between the variable name and the positions specified. Filename FN '/folders/myfolders/text/col2.txt'; Data DS; Infile FN firstobs=2; Input Name $ 1-11 Age 14-15; Run;

What does DSD option do?

It stands for delimiter-sensitive data. 1. It treats two consectuive delimiters as a missing value. This prevents the data from being shifted to the left. 2. It changes the delimiter from a space to a comma.

What does the WHERE statement do and what is special about it regarding the PDV?

It subsets the dataset before the data is read into the PDV.

What is the benefit of using pointer control in PUT statement? What should you be wary of?

It tells SAS to export the NAME and AGE columns at the 1st and 10th position, respectively so it is spaced out and aligned as specified. You should be wary of overlapping columns. Lets say Name is 8 characters and you place @1 Name and @5 is Age. Age will overwrite the values from the NAME column starting at @5.

What does the SUBSTR function do in SAS?

It tells SAS to extract the text from the variable starting from the nth position.

What does the % stand for in the following code: Data Students; Set sashelp.class; where name like 'J%'; Run;

It tells SAS to keep observations where te name follows the J% pattern. The % sign represents what we call a wildcard character. Represents any character values that start with the letter J.

What does the LIKE operator do?

It tells SAS to keep only the observations where the name follows a specific pattern.

What does the PUT statement tell SAS

It tells SAS to specficially print the two variables, NAME and AGE, to the external data file.

What happens when you place FIRSTOBS = N in the infile statement?

It tells SAS to start reading data from line N.

What does the OBS option do?

It tells SAS to stop reading the data at the nth observation

What happens when you read in an invalid date such as (01/32/2011)

It will result in a data error and there will be a missing value (.) in place of it. The error variable will change from 0 to 1;

Where does the KEEP option go and what does it do?

KEEP option is used to select variables to keep in the data set. It is placed in the SET statement in parentheses It can also be placed in the output statement as well! Data Class; Set SASHelp.class (keep=name age sex); Run; Data Class (keep=name age sex); Set SASHelp.class; Run; BOTH WORK!

What is the output of the following code: Data test; year = 1; amount = 0; amt_pyr = year/amount; Run;

Missing Value!

What does the following code accomplish? options nodate; Proc print data=sashelp.cars; Run;​

No date!

how do you interweave data sets?

Now, we are going to interleave the two data sets using the SET statement and the BY statement: Data Group; Set Group1 Group2; By ID; Run;

What is the number of observations in output when using OBS and FIRSTOBS

OBS - FIRSTOBS + 1

What does @ do in the input statement?

Prevents SAS from automatically moving the pointer to the next line after the INPUT statement. When you have multiple INPUT statements in the data step, you must place a single trailing @ at the end of each INPUT statement except for the last.

what is the program data vector?

Program Data Vector (PDV) is a logical area in memory where SAS builds a data set, one observation at a time. When a program executes, SAS reads data values from the input buffer or creates them by executing SAS language statements. The data values are assigned to the appropriate variables in the program data vector. From here, SAS writes the values to a SAS data set as a single observation.

The following SAS program is submitted: data work.flights; destination = 'CPH'; select(destination); when('LHR') city = 'London'; when('CPH') city = 'Copenhagen'; otherwise; end; run; Which one of the following is the value of the CITY variable? A. London B. Copenh C. Copenhagen D. ' ' (missing character value)

Question 10: The answer is (b). The length of the CITY variable is set as six. When assigning the value 'Copenhagen' to the variable, the value will get truncated to 'Copenh'.

The contents of the raw data file EMPLOYEE are listed below: --------10-------20-------30 Ruth 39 11 Jose 32 22 Sue 30 33 John 40 44 The following SAS program is submitted: data test; infile 'employee'; input employee_name $ 1-4; if employee_name = 'Ruth' then input idnum 10-11; else input age 7-8; run; Which one of the following values does the variable IDNUM contain when the name of the employee is "Ruth"? A. 11 B. 22 C. 32 D. . (missing numeric value)

Question 10: The answer is (b). Same reason as above. The missing trailing @ causes the input pointer to move to the next record when reading the IDNUM column. When it is 'Ruth', SAS reads the data from position 10-11 in the 2nd record. The value read is 22.

The following SAS program is submitted: data work.flights; destination = 'cph'; select(destination); when('LHR') city = 'London'; when('CPH') city = 'Copenhagen'; otherwise city = 'Other'; end; run; Which one of the following is the value of the CITY variable? A. Other B. Copenh C. Copenhagen D. ' ' (missing character value)

Question 11: The answer is (a). The value 'cph' is different than 'CPH'. The CITY variable is set as 'Other' since none of the values in the WHEN statement matches the value 'cph'.

The following SAS program is submitted: data numrecords; infile 'file-specification'; input @1 patient $15. relative $ 16-26 @; if relative = 'children' then input @54 diagnosis $15. @; else if relative = 'parents' then input @28 doctor $15. clinic $ 44-53 @54 diagnosis $15. @; input age; run; How many raw data records are read during each iteration of the DATA step during execution? A. 1 B. 2 C. 3 D. 4

Question 11: The answer is (a). Except for the very last INPUT statement. each of the INPUT statements in the code has a single trailing @ at the end of the statement. Only one record is read during each iteration.

The following SAS program is sumbitted: data WORK.INFO; infile 'DATAFILE.TXT'; input @1 Company $20. @25 State $2. @; if State=' ' then input @30 Year; else input @30 City Year; input NumEmployees; run; How many raw data records are read during each iteration of the DATA step? A. 1 B. 2 C. 3 D. 4

Question 12: The answer is (b). The INPUT statements in the if-then statement have no single trailing @ at the end of the statements. This causes SAS to read an extra record during each iteration. Two data records are read in each iteration. ​

----+----1----+----2----+---- RED ORANGE YELLOW GREEN BLUE INDIGO PURPLE VIOLET CYAN WHITE FUCSIA BLACK GRAY BROWN PINK MAGENTA The following SAS program is submitted: 1 2 3 4 5 data WORK.COLORS; infile 'COLORS.TXT'; input @1 Var1 $ @8 Var2 $ @; input @1 Var3 $ @8 Var4 $ @; run; What will the data set WORK.COLORS contain? Options: A. Var1 Var2 Var3 Var4 ------ ------ ------ ------ RED ORANGE RED ORANGE BLUE INDIGO BLUE INDIGO CYAN WHITE CYAN WHITE GRAY BROWN GRAY BROWN B. Var1 Var2 Var3 Var4 ------ ------ ------ ------ RED ORANGE BLUE INDIGO CYAN WHITE GRAY BROWN C. Var1 Var2 Var3 Var4 ------ ------ ------ ------ RED ORANGE YELLOW GREEN BLUE INDIGO PURPLE VIOLET D. Var1 Var2 Var3 Var4 ------ ------ ------ ------ RED ORANGE YELLOW GREEN BLUE INDIGO PURPLE VIOLET CYAN WHITE FUCSIA BLACK GRAY BROWN PINK MAGENTA

Question 13: The answer is (a). The VAR1 and VAR3 read the data from the same column. The two columns should be identical. Same for VAR2 and VAR4.

The following SAS program is submitted: data work.staff; JobCategory = 'FA'; JobLevel = '1'; JobCategory = JobCategory || JobLevel; run; Which one of the following is the value of the variable JOBCATEGORY in the output data set? A. FA B. FA1 C. FA 1 D. ' ' (missing character value)

Question 1: The answer is (a). The length of the JOBCATEGORY variable is set as 2. It does not have sufficient length to capture the value 'FA1'. Only the value 'FA' is kept in the variable.

Given the SAS data set EMPLOYEES: EMPLOYEES NAME SALARY -------- ----------- Innis 60000 Jolli 50000 Ellis 55000 Liu 45000 The following SAS program is submitted: proc print data = employees; where name like '_i%'; run; What is contained in the output? A. Innis, Ellis, and Liu only B. Liu only C. Innis, Jolli, Ellis, and Liu D. Innis and Ellis only

Question 1: The answer is (b). The '_i%' pattern represents any character values where the second character is the letter 'i'. Only the name "Liu" follows this pattern.

The SAS data set WORK.AWARDS is listed below: fname points Amy 2 Amy 1 Gerard 3 Wang 3 Wang 1 Wang 2 The following SAS program is submitted: proc sort data = work.awards; by descending fname points; run; Which one of the following represents how the observations are sorted? A. Wang 3 Gerard 3 Wang 2 Amy 2 Wang 1 Amy 1 B. Wang 3 Wang 2 Wang 1 Gerard 3 Amy 2 Amy 1 C. Wang 3 Wang 1 Wang 2 Gerard 3 Amy 2 Amy 1 D. Wang 1 Wang 2 Wang 3 Gerard 3 Amy 1 Amy 2

Question 1: The answer is (d). The data set is sorted by POINTS in ascending order within each FNAME in descending order. The first three observations should be: Wang 1 Wang 2 Wang 3

The contents of the raw data file CALENDAR are listed below: --------10-------20-------30 01012000 The following SAS program is submitted: data test; infile 'calendar'; input @1 date mmddyy10.; if date = '01012000'd then event = 'January 1st'; run; Which one of the following is the value of the EVENT variable? A. 01012000 B. January 1st C. . (missing numeric value) D. The value can not be determined as the program fails to execute due to errors.

Question 1: The answer is (d). The date value ('01012000'd) is written in an incorrect form. This will result in a syntax error.

Question 5: The following SAS program is submitted: 1 2 3 4 5 6 data WORK.LOOP; X = 0; do Index = 1 to 5 by 2; X = Index; end; run; Upon completion of execution, what are the values of the variables X and Index in the SAS data set named WORK.LOOP? Options: A. X = 3, Index = 5 B. X = 5, Index = 5 C. X = 5, Index = 6 D. X = 5, Index = 7

Question 1: The answer is (d). The loop continues until the index variable passes the ending value of the loop. At the beginning of the third round of looping, the INDEX is set to five. X is then assigned the value five. At the END statement, the INDEX goes up to seven. SAS goes back to the beginning of the do-loop and evaluates whether to continue the loop. Since the INDEX variable (7) now passes the ending value of the loop (5), the loop ends and the variables are written to the data set.

The following SAS program is submitted: data work.new; length word $7; amount = 7; if amount = 5 then word = 'CAT'; else if amount = 7 then word = 'DOG'; else word = 'NONE!!!'; amount = 5; run; Which one of the following represents the values of the AMOUNT and WORD variables? A. amount word 5 DOG B. amount word 5 CAT C. amount word 7 DOG D. amount word 7 ' ' (missing character value)

Question 1: The answer is (a). The AMOUNT variable is assigned the numeric value (7) in the beginning. The WORD variable is assigned the value "DOG" from the ELSE statement. The AMOUNT variable is then written and it is assigned the numeric value (5).

The following SAS program is submitted: data newstaff; set staff; <insert WHERE statement here> run; Which one of the following WHERE statements complete the program and selects only observations with a HIRE_DATE of February 23, 2000? A. where hire_date = '23feb2000'd; B. where hire_date = '23feb2000'; C. where hire_date = '02/23/2000'd; D. where hire_date = '02/23/2000';

Question 2: The answer is (a). The correct form of the date value is ('23feb2000'd).

The SAS data set EMPLOYEE_INFO is listed below: IDNumber Expenses 2542 100.00 3612 133.15 2198 234.34 2198 111.12 The following SAS program is submitted: proc sort data = employee_info; run; Which one of the following BY statements completes the program and sorts the data sequentially by ascending expense values within each ascending IDNUMBER value? A. by Expenses IDNumber; B. by IDNumber Expenses; C. by ascending (IDNumber Expenses); D. by ascending IDNumber ascending Expenses;

Question 2: The answer is (b). In order to sort the data set by EXPENSES within each IDNUMBER, the BY statement must list the IDNUMBER followed by EXPENSES. ----

The following SAS program is submitted: data work.products; Product_Number = 5461; Item = '1001'; Item_Reference = ltem||'/'IlProduct_Number; run; Which one of the following is the value of the variable ITEM_REFERENCE in the output data set? A. 1001/5461 B. 1001/ 5461 C. . (missing numeric value) ​ D. The value can not be determined as the program fails to execute due to errors.

Question 2: The answer is (b). When concatenating a character value with a numeric value, the numeric value is automatically converted to character using the (best12.) format. The value '5461' takes up only four characters. The converted character value will contain eight leading spaces followed by the value '5461'. The leading spaces are then captured in the combined value in the ITEM_REFERENCE variable.

Which ODS statement option terminates output being written to an HTML rile? A. END B. QUIT C. STOP ​D. CLOSE

Question 2: The answer is (d). The ODS is terminated by the CLOSE option.

The following SAS program is submitted: data work.new; length word $7; amount = 4; if amount = 4 then word = 'FOUR'; else if amount = 7 then word = 'SEVEN'; else word = 'NONE!!!'; amount = 7; run; Which one of the following represents the values of the AMOUNT and WORD variables? A. amount word 7 FOUR B. amount word 7 SEVEN C. amount word 4 FOUR D. amount word 4 ' ' (missing character value)

Question 2: The answer is (a). Same reason as above.

The following SAS program is submitted: data _null_; set old (keep = prod sales1 sales2); file 'file-specification'; put sales1 sales2; run; Which one of the following default delimiters separates the fields in the raw data file created? A. : (colon) B. (space) C. , (comma) D. ; (semicolon)

Question 2: The answer is (b). The space is the default delimiter when using the FILE statement to export the data.

The following SAS program is submitted: ods html file='newfile.html'; proc print data=sasuser.houses; run; roc means data=sasuser.houses; run; proc freq data=sasuser.shoes; run; ods html close; proc print data=sasuser.shoes; run; How many HTML files are created? a. 1 b. 2 c. 3 ​d. 4

Question 3: The answer is (a). Since there is only one set of ODS statements, there is only one HTML file created. The results from the PRINT, MEANS and FREQ procedures will be included in a single HTML file.

The following SAS program is submitted: data WORK.DATE_INFO; X="01Jan1960″D ; run; Variable X contains what value? A. the numeric value 0 B. the character value "01Jan1960" C. the date value 01011960 D. the code contains a syntax error and does not execute.

Question 3: The answer is (a). The integer representing the date of January 1, 1960 is 0.

A realtor has two customers. One customer wants to view a list of homes selling for less than $60,000. The other customer wants to view a list of homes selling for greater than $100,000. Assuming the PRICE variable is numeric, which one of the following PRINT procedure steps will select all desired observations? A. proc print data = sasuser.houses; where price lt 60000; where price gt 100000; run; B. proc print data = sasuser.houses; where price lt 60000 or price gt 100000; run; C. proc print data = sasuser.houses; where price lt 60000 and price gt 100000; run; D. proc print data = sasuser.houses; where price lt 60000 or where price gt 100000; run;

Question 3: The answer is (b). The following WHERE statement keeps only the properties where the price is either below 60,000 or above 100,000: where price lt 60,000 or price gt 100,000;

The SAS data set BANKS is listed below: BANKS name rate FirstCapital 0.0718 DirectBank 0.0721 VirtualDirect 0.0728 The following SAS program is submitted: data newbank; do year = 1 to 3; set banks; capital + 5000; end; run; Which one of the following represents how many observations and variables will exist in the SAS data set NEWBANK? A. 0 observations and 0 variables B. 1 observations and 4 variables C. 3 observations and 3 variables D. 9 observations and 2 variables

Question 3: The answer is (b). There is not OUTPUT statement within the do-loop. The SET statement is executed three times. However, only the third observations read into the PDV are written to the data set. There is one observation with four variables in the output data set.

The following SAS program is submitted: data work.total; set work.salary(keep = department wagerate); by department; if first.department then payroll = 0; payroll + wagerate; if last.department; run; The SAS data set named WORK.SALARY contains 10 observations for each department, currently ordered by DEPARTMENT. Which one of the following is true regarding the program above? A. The BY statement in the DATA step causes a syntax error. B. FIRST.DEPARTMENT and LAST.DEPARTMENT are variables in the WORK.TOTAL data set. C. The values of the variable PAYROLL represent the total for each department in the WORK.SALARY data set. D. The values of the variable PAYROLL represent a total for all values of WAGERATE in the WORK.SALARY data set.

Question 3: The answer is (c). The PAYROLL variable contains the total salaries for each department.

The following SAS program is submitted: data test; set sasuser.employees; if 2 le years_service le 10 then amount = 1000; else if years_service gt 10 then amount = 2000; else amount = 0; amount_per_year = years_service / amount; run; Which one of the following values does the variable AMOUNT_PER_YEAR contain if an employee has been with the company for one year? A. 0 B. 1000 C. 2000 D. . (missing numeric value)

Question 3: The answer is (d). The AMOUNT variable is 0 because the year of service is only 1. Dividing the year by 0 will result in a missing value.

The following SAS program is submitted: data work.test; length city $20; city='Paris'; city2=trim(city); run; Which one of the following is the length of the city2 variable? a. 5 b. 6 c. 8 ​d. 20

Question 3: The answer is (d). The length of the CITY2 variable is the same as the CITY variable, which is 20.

A frequency report of the variable Jobcode in the Work.Actors data set is listed below. Jobcode Frequency Percent Cumulative Cumulative Frequency Percent Actor I 2 33.33 2 33.33 Actor II 2 33.33 4 66.67 Actor III 2 33.33 6 100.00 Frequency Missing = 1 The following SAS program is submitted: data work.joblevels; set work.actors; if jobcode in ('Actor I', 'Actor II') then joblevel = 'Beginner'; if jobcode = 'Actor III' then joblevel = 'Advanced'; else joblevel = 'Unknown'; run; Which of the following represents the possible values for the variable JOBLEVEL in the WORK.JOBLEVELS data set? A. Advanced and Unknown only B. Beginner and Advanced only C. Beginner, Advanced, and Unknown D. ' ' (missing character value)

Question 3: The answer is (a). The ELSE statement is missing in the second IF statement. Below is how the if-then statements are executed: 1. JobLevel is set as 'Beginner' for Actor I and Actor II 2. JobLevel is set as 'Advanced' for Actor III 3. JobLevel is set as 'Unknown' for all of the observations that are not Actor III. This overwrites the 'Beginner' value originally assigned to Actor I and Actor II. As a result, the JobLevel contains only 'Advanced' and 'Unknown'.

VARIABLE NAME TYPE idnum character variable sales_date numeric date value A comma delimited raw data file needs to be created from the PERM.JAN_SALES data set. The SALES_DATE values need to be in a MMDDYY10 form. Which one of the following SAS DATA steps correctly creates this raw data file? A. libname perm 'SAS-data-library'; data _null_; set perm.jan_sales; file 'file-specification' dsd = ','; put idnum sales_date : mmddyy10.; run; B. libname perm 'SAS-data-library'; data _null_; set perm.jan_sales; file 'file-specification' dlm = ','; put idnum sales_date : mmddyy10.; run; C. libname perm 'SAS-data-library'; data _null_; set perm.jan_sales; file 'file-specification'; put idnum sales_date : mmddyy10. dlm = ','; run; D. libname perm 'SAS-data-library'; data _null_; set perm.jan_sales; file 'file-specification'; put idnum sales_date : mmddyy10. dsd = ','; run;

Question 3: The answer is (b). The DLM=',' option is used to change the delimiter to a comma. The DSD option also changes the delimiter to a comma. However, the DSD option must be used alone. The syntax (DSD=',') is not correct. Both of the DSD and DLM options are used in the FILE statement, not the PUT statement.

An HTML file contains a SAS report. Which ODS statement option is used to specify the name of the HTML file? a. OUT= b. FILE= c. HTML= ​d. HTMLFILE=

Question 4: The answer is (b). The FILE option is used to specify the name of the HTML file.

The following SAS program is submitted: data work.pieces; do while (n lt 6); n + 1; end; run; Which one of the following is the value of the variable N in the output data set? A. 4 B. 5 C. 6 D. 7

Question 4: The answer is (c). The DO WHILE statement continues the loop for as long as the condition (n lt 6) is true. The loop ends when n becomes six.

The following SAS DATA step executes on Monday, April 25, 2000: data newstaff; set staff; start_date = today(); run; Which one of the following is the value of the variable START_DATE in the output data set? A. a character string with the value '04/25/2000' B. a character string with the value 'Monday, April 25, 2000' C. the numeric value 14725, representing the SAS date for April 25, 2000 D. the numeric value 04252000, representing the SAS date for April 25, 2000

Question 4: The answer is (c). The TODAY() function returns the SAS date constant for today's date. Since the data step was executed on April 25, 2000, the SAS date constant is 14725. ----

The following SAS program is submitted: data work.month; date = put('13mar2000'd,ddmmyy10.); run; Which one of the following represents the type and length of the variable DATE in the output data set? A. numeric, 8 bytes B. numeric, 10 bytes C. character, 8 bytes D. character, 10 bytes

Question 4: The answer is (d). The variable created by the PUT function is always a character variable. The DATE variable contains the value "13/03/2000" which is 10 characters long. The length of the DATE variable is 10.

The following SAS program is submitted: data names; title = 'EDU'; if title = 'EDU' then division = 'Education'; else if title = 'HR' then division = 'Human Resources'; else division = 'Unknown'; run; Which one of the following represents the value of the variable DIVISION in the output data set? A. Educatio B. Education C. Human Re D. Human Resources

Question 4: The answer is (b). The title is set as 'EDU'. The first IF statement is true. The Division is set as 'Education'. Note: when creating the variable with an assignment statement (e.g. Division='Education'), the variable length is assigned based on the very first assignment statement in the code. In our example, the value 'Education' is assigned to the variable. The variable length is set as nine.

The contents of the SAS data set named PERM.STUDENTS are listed below: name age Alfred 14 Alice 13 Barbara 13 Carol 14 The following SAS program is submitted using the PERM.STUDENTS data set as input: libname perm 'SAS-data-library'; data students; set perm.students; file 'file-specification'; put name $15. @5 age 2.; run; Which one of the following represents the values written to the output raw data file? A. --------10-------20-------30 Alfred 14 Alice 13 Barbara 13 Carol 14 B. --------10-------20-------30 Alfr14 Alic13 Barb13a Caro14 C. --------10-------20-------30 Alfr14ed Alic13e Barb13ara Caro14l D. --------10-------20-------30 Alfred 14 Alice 13 Barbara 13 Carol 14

Question 4: The answer is (b). With the (@5) pointer control, the AGE column overwrites the values from position 5-6.

The following SAS DATA step is submitted: libname temp 'SAS-data-library'; data temp.report; set sasuser.houses; newvar = price * 1.04; run; Which one of the following statements is true regarding the program above? A. The program is reading from a temporary data set and writing to a temporary data set. B. The program is reading from a temporary data set and writing to a permanent data set. C. The program is reading from a permanent data set and writing to a temporary data set. D. The program is reading from a permanent data set and writing to a permanent data set. Click Comment link to get answer

Question 4: The answer is (d). The data is read from SASUSER.HOUSES and written to TEMP.REPORT. Both are permanent SAS data sets.

A raw data file is listed below: --------10-------20-------30 1901 2 1905 1 1910 6 1925 . 1941 1 The following SAS program is submitted and references the raw data file above: data coins; infile 'file-specification'; input year quantity; run; Which one of the following completes the program and produces a non-missing value for the variable TOTQUANTITY in the last observation of the output data set? A. totquantity + quantity; B. totquantity = sum(totquantity + quantity); C. totquantity 0; sum totquantity; D. retain totquantity 0; totquantity = totquantity + quantity;

Question 5: The answer is (a). There are two ways to compute the cumulative summation. You can use either the SUM statement or the RETAIN statement with the SUM function. The answer (d) is not correct because of the missing value in the fourth observation. The correct answer is (a).

A raw data file is listed below: ----|----10---|----20---|----30 10 23 20 15 The following SAS program is submitted using the raw data file as input: data all_sales; infile file-specification; input receipts; <insert statement(s) here> run; Which of the following completes the program and produces a running total of the values of the RECEIPTS variable? A. total + receipts; B. total 0; sum total; C. total = total + receipts; ​D. total = sum(total,receipts);

Question 5: The answer is (a). There are two ways to compute the cumulative summation. You can use either the SUM statement or the RETAIN statement with the SUM function. The answer (d) is not correct because of the missing value in the fourth observation. The correct answer is (a). Question 6: The answer is (a). In order to compute the running total of the RECEIPTS variable, the values must be retained from one iteration to the next. The SUM statement in (a) has an implied RETAIN statement and SUM function which computes the running total of the RECEIPTS variable.

The following SAS program is submitted: data work.test; Title = 'A Tale of Two Cities, Charles J. Dickens'; Word = scan(title,3,' ,'); run; Which one of the following is the value of the variable WORD in the output data set? A. T B. of C. Dickens D. ' ' (missing character value)

Question 5: The answer is (b). The delimiter is specified as ' ,' which includes a blank space and the comma. Both the comma and the blank space are used as the delimiter. The word 'of' is returned since it is the third word from the sentence.

A raw data record is listed below: (Question updated: underscores means blank spaces) --------10-------20-------30 Printing___750 The following SAS program is submitted: data bonus; infile 'file-specification'; input dept $ 1 - 11 number 13 - 15; run; Which one of the following SAS statements completes the program and results in a value of 'Printing750' for the DEPARTMENT variable? A. department = trim(dept) number; B. department = dept input(number,3.); C. department = trim(dept) || put(number,3.); D. department = input(dept,11.) || input(number,3.);

Question 5: The answer is (c). The PUT function is needed to convert the NUMBER variable while removing the leading spaces from the converted value.

Which of the following statements creates a numeric variable named IDnumber with a value of 4198? a. IDnumber=4198; b. IDnumber='4198'; c. length IDnumber=8; ​d. length IDnumber $ 8;

Question 5: The answer is (a). You do not need quotations to assign numeric values to a variable.

The following SAS program is submitted: data WORK.TEST; set WORK.PILOTS; if Jobcode='Pilot2′ then Description='Senior Pilot'; else Description='Unknown'; run; The value for the variable Jobcode is: PILOT2. What is the value of the variable Description? A. PILOT2 B. Unknown C. Senior Pilot D. ' ' (missing character value)

Question 5: The answer is (b). Character values in SAS are case sensitive. The value 'PILOT' is different than 'Pilot'. The description is set as 'Unknown'.

The following SAS program is submitted: data work.january; set work.allmonths (keep = product month num_sold cost); if month = 'Jan' then output work.january; sales = cost * num_sold; keep = product sales; run; Which variables does the WORK.JANUARY data set contain? A. PRODUCT and SALES only B. PRODUCT, MONTH, NUM_SOLD and COST only C. PRODUCT, SALES, MONTH, NUM_SOLD and COST only D. An incomplete output data set is created due to syntax errors.

Question 5: The answer is (d). The syntax in the KEEP statement (i.e. keep = product sales) is incorrect.

Base SAS 59 The following SAS program is submitted: data work.passengers; if OrigPassengers = . then OrigPassengers = 100; TransPassengers = 100; OrigPassengers = .; NonPaying = 10; TotalPassengers = sum (OrigPassengers, TransPassengers); run; Which one of the following is the value of the TOTALPASSENGERS variable in the output data set? A. 100 B. 110 C. 200 D. . (missing numeric value) Click Comment link to get answer

Question 6: The answer is (a). The SUM function will ignore the missing value. The TOTALPASSENGERS variable will be set as (100).

The following SAS program is submitted: data WORK.TOTAL_SALARY; retain Total; set WORK.SALARY; by Department; if First.Department then Total=0; Total=sum(Total, Wagerate); if Last.Total; run; What is the initial value of the variable Total? A. 0 B. Missing C. The value of the first observations Wagerate D. Cannot be determined from the information given

Question 6: The answer is (b). When no initial value is specified for the variable in the RETAIN statement, the variable is initiated with a missing value.

Given the SAS data set WORK.ORDERS: order_id customer shipped 9341 Josh Martin 02FEB2009 9874 Rachel Lords 14MAR2009 10233 Takashi Sato 07JUL2009 The variable order_id is numeric; customer is character; and shipped is numeric, contains a SAS date value,and is shown with the DATE9. format. A programmer would like to create a new variable, ship_note,that shows a character value with the order_id,shipped date, and customer name. For example, given the first observation ship_note would have the value "Order 9341 shipped on 02FEB2009 to Josh Martin". Which of the following statement will correctly create the value and assign it to ship_note? A. ship_note=catx(' ','Order',order_id,'shipped on',input(shipped,date9.),'to',customer); B. ship_note=catx(' ','Order',order_id,'shipped on',char(shipped,date9.),'to',customer); C. ship_note=catx(' ','Order',order_id,'shipped on',tranwrd(shipped,date9.),'to',customer); D. ship_note=catx(' ','Order',order_id,'shipped on',put(shipped,date9.),'to',customer);

Question 6: The answer is (d). The PUT function should be used to convert the SHIPPED variable to character.

The following SAS program is submitted: data WORK.ONE; Text='Australia, US, Denmark'; Pos=find(Text,'US','i',5); run; What value will SAS assign to Pos? A. 0 B. 1 C. 2 D. 12

Question 6: The answer is (d). The starting position is specified as 5. The first five characters are ignored. SAS finds the text 'US' from position 12 and returns it as the result.

The following SAS program is submitted: data revenue; set year_1; var1 = mdy(1,15,1960); run; Which one of the following values does the variable named VAR1 contain? A. 14 B. 15 C. 1151960 D. '1/15/1960'

Question 7: The answer is (a). The SAS date constant for January 15, 1960 is 14.

The following SAS program is submitted: proc report data = survey nowd; column age choice1; <insert DEFINE statement here> define choice1 / display; run; Which one of the following DEFINE statements completes the program and displays values of the AGE variable in ascending sequence? A. define age / sort; B. define age / order; C. define age / sort by age; ​D. define age / order by age;

Question 7: The answer is (b). In order to list the column in ascending order, you have to specify ORDER in the DEFINE statement.

Which one of the following SAS statements correctly computes the average of four numerical values? A. average = mean(num1 - num4); B. average = mean(of num1 - num4); C. average = mean(of num1 to num4); D. average = mean(num1 num2 num3 num4);

Question 7: The answer is (b). You must precede the variable list by the keyword OF in the parameter.

Question 10: The following SAS program is submitted: data WORK.TEMP; Char1='0123456789'; Char2=substr(Char1,3,4); run; What is the value of Char2? Options: A. 23 B. 34 C. 345 D. 2345

Question 7: The answer is (d). The CHAR2 variable extracts the text starting from the third position for four characters. The text '2345' is extracted into CHAR2.

Given the SAS data set WORK.ONE: Obs Revenue2008 Revenue2009 Revenue2010 1 1.2 1.6 2 The following SAS program is submitted: data WORK.TWO; set WORK.ONE; Total=mean(of Rev:); run; What value will SAS assign to Total? A. 3 B. 1.6 C. 4.8 D. The program fails to execute due to errors.

Question 8: The answer is (b). Mean(of Rev:) computes the data average for all of the variables that start with "Rev". It computes the mean of Rev2008, Rev2009 and Rev2010.

The SAS data set named WORK.TEST is listed below: capacity airplanetype staff 150 Large 10 Which one of the following SAS programs created this data set? A. data work.test; capacity = 150; if 100 le capacity le 200 then airplanetype = 'Large' and staff = 10; else airplanetype = 'Small' and staff = 5; run; B. data work.test; capacity = 150; if 100 le capacity le 200 then do; airplanetype = 'Large'; staff = 10; end; else do; airplanetype = 'Small'; staff = 5; end; run; C. data work.test; capacity = 150; if 100 le capacity le 200 then do; airplanetype = 'Large'; staff = 10; else do; airplanetype = 'Small'; staff = 5; end; run; D. data work.test; capacity = 150; if 100 le capacity le 200 then; airplanetype = 'Small'; staff = 5; else; airplanetype = 'Large'; staff = 10; run;

Question 8: The answer is (b). When conditionally executing more than one statement in the data step, you must enclose the statements to be executed with the DO and END statements.

The following SAS program is submitted: libname temp 'SAS-data-library'; data work.new; set temp.jobs; format newdate mmddyy10.; qdate = qtr(newdate); ddate = weekday(newdate); run; proc print data = work.new; run; The variable NEWDATE contains the SAS date value for April 15, 2000. What output is produced if April 15, 2000 falls on a Saturday? A. Obs newdate qdate ddate 1 APR152000 2 6 B. Obs newdate qdate ddate 1 04/15/2000 2 6 C. Obs newdate qdate ddate 1 APR152000 2 7 D. Obs newdate qdate ddate 1 04/15/2000 2 7

Question 8: The answer is (d). Since the date of April 15, 2000 falls on a Saturday, the DDATE variable returns the value 7. The NEWDATE variable is assigned the format of (mmddyy10.). It is displayed as (04/15/2000).

Given the SAS data set WORK.P2000: Location Pop2000 Alaska 626931 Delaware 783595 Vermont 608826 Wyoming 493782 and the SAS data set WORK.P2008: State Pop2008 Alaska 686293 Delaware 873092 Wyoming 532668 The following output is desired: Obs State Pop2000 Pop2008 Difference 1 Alaska 626931 686293 59362 2 Delaware 783595 873092 89497 3 Wyoming 493782 532668 38886 Which SAS program correctly combines the data? A. data compare; merge WORK.P2000(in=_a Location=State) WORK.P2008(in=_b); by State; if _a and _b; Difference=Pop2008-Pop2000; run; B. data compare; merge WORK.P2000(rename=(Location=State)) WORK.P2008; by State; if _a and _b; Difference=Pop2008-Pop2000; run; C. data compare; merge WORK.P2000(in=_a rename=(Location=State)) WORK.P2008(in=_b); by State; if _a and _b; Difference=Pop2008-Pop2000; run; D. data compare; merge WORK.P2000(in=_a) (rename=(Location=State)) WORK.P2008(in=_b); by State; if _a and _b; Difference=Pop2008-Pop2000; run;

Question 9: The answer is (c). You need the RENAME data set option to rename the LOCATION variable as STATE. You also need the (in=) data set option to ensure only the matched observations are kept in the output.

The contents of the raw data file EMPLOYEE are listed below: --------10-------20-------30 Ruth 39 11 (39 starts at col-7 and 11 at col-10) Jose 32 22 Sue 30 33 John 40 44 The following SAS program is submitted: data test; infile 'employee'; input employee_name $ 1-4; if employee_name = 'Sue' then input age 7-8; else input idnum 10-11; run; Which one of the following values does the variable AGE contain when the name of the employee is "Sue"? A. 30 B. 33 C. 40 D. . (missing numeric value)

Question 9: The answer is (c). The missing trailing @ from the first INPUT statement causes the input pointer to move to the next line when importing the AGE column. When the name is 'Sue', SAS reads the data from position 7-8 in the 4th record. The value read is 40.

What does date9. output?

Reads as DDMMYYYY. 07JAN2002

What happens in the below code: Data Retail; cost = '20000'; total = .10 * cost; run;

SAS automatically converts the character value into a numeric value

What happens durin gthe compilation phase?

SAS checks code for syntax errors; Create input buffer, PDV and descriptor portion of data set. no data is read or written in this phase

How do you write a SAS date constant?

SAS date constant can be written in the form of 'DDMMMYYYY'd.

What is the difference between syntax error and data error?

SAS will still execute the code despite presence of the data error. The field containing the data error will be set to missing.

DROP statements

Similar to the KEEP statement. It can be in both data or set. The KEEP and DROP options can be used within a single data step.

What is the difference between the SUM function and the (+) sign?

The (+) operator cannot add missing values, but the SUM function ignores missing values.

What is the difference between DO WHILE and DO UNTIL?

The DO WHILE statement continues the loop for as long as a specified condition is true. The DO UNTIL statement continues the loop until a specified condition is true.

Given the SAS data set WORK.ONE: Id Char1 111 A 158 B 329 C 644 D and the SAS data set WORK.TWO: Id Char2 111 E 538 F 644 G The following program is submitted: data WORK.BOTH; set WORK.ONE WORK.TWO; by Id; run; What is the first observation in SAS data set WORK.BOTH? A. Id Char1 Char2 111 A B. Id Char1 Char2 111 E C. Id Char1 Char2 111 A E D. Id Char1 Char2 644 D G

The answer is (a). SAS interleaves the data sets by the ID variable. The combined data set is sorted by ID. The first observation should be: ID CHAR1 CHAR2 111 A (missing)

The following SAS program is submitted: proc means data = sasuser.houses std mean max; var sqfeet; run; Which one of the following is needed to display the standard deviation with only two decimal places? A. Add the option MAXDEC = 2 to the MEANS procedure statement. B. Add the statement MAXDEC = 7.2; in the MEANS procedure step. C. Add the statement FORMAT STD 7.2; in the MEANS procedure step. D. Add the option FORMAT = 7.2 option to the MEANS procedure statement.

The answer is (a). The (MAXDEC=2) option can be used to display the statistics with two decimal places.

Given the raw data record in the file phone.txt: ----|----10---|----20---|----30---| Stevens James SALES 304-923-3721 14 The following SAS program is submitted: data WORK.PHONES; infile 'phone.txt'; input EmpLName $ EmpFName $ Dept $ Phone $ Extension; <_insert_code_> run; Which SAS statement completes the program and results in a value of "James Stevens" for the variable FullName? A. FullName=CATX(' ',EmpFName,EmpLName); B. FullName=CAT(' ',EmpFName,EmpLName); C. FullName=EmpFName||EmpLName; D. FullName=EmpFName + EmpLName;

The answer is (a). The CATX function combines the first and last name with a single space as the delimiter separating the two names.

The following SAS program is submitted: data work.month; date = input('13mar2000',date9.); run; Which one of the following represents the type and length of the variable DATE in the output data set? A. numeric, 8 bytes B. numeric, 9 bytes C. character, 8 bytes D. character, 9 bytes

The answer is (a). The DATE variable is created by the INPUT function. It is a numeric variable with a length of eight.

Given the following data step: data WORK.GEO; infile datalines; input City $20.; if City='Tulsa' then State='OK'; Region='Central'; if City='Los Angeles' then State='CA'; Region='Western'; datalines; Tulsa Los Angeles Bangor ; run; After data step execution, what will data set WORK.GEO contain?

The answer is (a). The DO-END statements are missing in the data step. The value 'Western' overwrites the value previously assigned to the REGION variable. The REGION variable is set as 'Western' for each of the observations in the data set.

Unless specified, which variables and data values are used to calculate statistics in the MEANS procedure? A. non-missing numeric variable values only B. missing numeric variable values and non-missing numeric variable values only C. non-missing character variables and non-missing numeric variable values only D. missing character variables, non-missing character variables, missing numeric variable values, and non-missing numeric variable values

The answer is (a). The MEANS procedure uses only the non-missing numeric values to compute the statistics.

The following SAS program is submitted: proc contents data=sasuser._all_ nods; run; Which one of the following is produced as output? a. the list of all data set names in the Sasuser library only b. the descriptor portion of the data set named Sasuser._All_ c. the descriptor portion of every data set in the Sasuser library only ​d. the list of data set named in the Sasuser library plus the descriptor portion of every data set in the Sasuser library.

The answer is (a). The NODS option suppress the printing of the contents details of the data sets. Only the list of all data set names in the library is displayed.

The following SAS program is submitted: data work.AreaCodes; Phonenumber=3125551212; Code='('!!substr(Phonenumber,1,3)!!')'; run; Which one of the following is the value of the variable Code in the output data set? a. ( 3) b. (312) c. 3 ​d. 312

The answer is (a). The PHONENUMBER variable is a numeric variable. When using the SUBSTR function on a numeric variable, SAS automatically converts it to character using the (best12.) format. Two additional blank spaces are added to the value. The CODE variable will contain ( 3) with two blank spaces before the numeric value (3).

The following SAS program is submitted: data work.test; Author = 'Christie, Agatha'; First = substr(scan(author,2,' ,'),1,1); run; Which one of the following is the value of the variable FIRST in the output data set? A. A B. C C. Agatha D. ' ' (missing character value)

The answer is (a). The SCAN function returns the second word from the AUTHOR variable, which is 'Agatha'. The SUBSTR function extracts the first character from the text 'Agatha' and it returns the value 'A'.

The following SAS program is submitted: data work.empsalary; set work.people (in = inemp) work.money (in = insal); if insal and inemp; run; The SAS data set WORK.PEOPLE has 5 observations, and the data set WORK.MONEY has 7 observations. How many observations will the data set WORK.EMPSALARY contain? A. 0 B. 5 C. 7 D. 12

The answer is (a). The SET statement concatenates the PEOPLE and MONEY data sets. When concatenating data sets, each observation is contributed by a single data set. The IF statement attempts to keep only the observations that are contributed by both input data sets. As a result, there is no observation in the output.

The SAS data set PETS is sorted by the variables TYPE and BREED. The following SAS program is submitted: proc print data = pets; var type breed; sum number; run; What is the result? A. The SUM statement produces only a grand total of NUMBER. B. The SUM statement produces only subtotals of NUMBER for each value of TYPE. C. The SUM statement produces both a grand total of NUMBER and subtotals of NUMBER for each value of TYPE. D. Nothing is produced by the SUM statement; the program fails to execute.

The answer is (a). The SUM statement produces a grand total of the NUMBER variable at the bottom of the table.

given the SAS data set SASDATA.TWO: X Y 5 2 3 1 5 6 The following SAS program is submitted: data SASUSER.ONE SASUSER.TWO OTHER; set SASDATA.TWO; if X eq 5 then output SASUSER.ONE; if Y lt 5 then output SASUSER.TWO; output; run; What is the result? A. data set SASUSER.ONE has 5 observations data set SASUSER.TWO has 5 observations data set WORK.OTHER has 3 observations B. data set SASUSER.ONE has 2 observations data set SASUSER.TWO has 2 observations data set WORK.OTHER has 1 observations C. data set SASUSER.ONE has 2 observations data set SASUSER.TWO has 2 observations data set WORK.OTHER has 5 observations D. No data sets are output. The DATA step fails execution due to syntax errors

The answer is (a). The first if-then statement writes two observations to the data set SASUSER.ONE. The second if-then statement writes two observations to the data set SASUSER.TWO The last OUTPUT statement writes three observations to each of the SASUSER.ONE, SASUSER.TWO and OTHER data sets. In the end, the number of observations in each data sets are: SASUSER.ONE: 5 SASUSER.TWO: 5 OTHER: 3

The following program is submitted: data fltaten; input jobcode $ salary name $; cards; FLAT1 70000 Bob FLAT2 60000 Joe FLAT3 30000 Ann ; run; data desc; set fltaten; if salary>60000 then description='Over 60'; else description='Under 60'; run; What is value of the variable named description when the value for salary is 30000? a. Under 6 b. Under 60 c. Over 60 ​d. ' ' (missing character value) ​

The answer is (a). The length of the DESCRIPTION variable is set based on the very first assignment statement in the data step. In this example, it is (description = 'Over 60'). There are seven characters in total and the length is set as seven. When the value 'Under 60' is assigned to the variable, the length is not enough to capture the entire value. The data gets truncated and the variable contains 'Under 6'

The following SAS program is submitted: data work.accounting; set work.dept1 work.dept2; run; A character variable named JOBCODE is contained in both the WORK.DEPT1 and WORK.DEPT2 SAS data sets. The variable JOBCODE has a length of 5 in the WORK.DEPT1 data set and a length of 7 in the WORK.DEPT2 data set. Which one of the following is the length of the variable JOBCODE in the output data set? A. 5 B. 7 C. 8 D. 12

The answer is (a). The length of the JOBCODE variable follows the first data set listed in the SET statement. In this question, it is the DEPT1 data set where the length of JOBCODE is 5.

The following SAS program is submitted: data work.total; set work.salary(keep = department wagerate); by department; if first.department then payroll = 0; payroll + wagerate; if last.department; run; The SAS data set WORK.SALARY, currently ordered by DEPARTMENT, contains 100 observations for each of 5 departments. Which one of the following represents how many observations the WORK.TOTAL data set contains? A. 5 B. 20 C. 100 D. 500

The answer is (a). The output data set contains only the last observation for each department. There are five departments in total and there are only five observations in the output.

The following SAS program is submitted: libname company 'SAS-data-library'; proc sort data = company.payroll; by EmployeeIDNumber; run; Write access has been granted to the COMPANY library. Which one of the following represents how the observations are sorted? A. COMPANY.PAYROLL is recreated in sorted order by EmployeeIDNumber. B. COMPANY.PAYROLL is stored in original order, and a new data set PAYROLL is created in sorted order by EmployeeIDNumber. C. COMPANY.PAYROLL is stored in original order, and a new data set COMPANY.PAYROLLSORTED is created in sorted order by EmployeeIDNumber. D. COMPANY.PAYROLL is recreated in sorted order by EmployeeIDNumber, and a new data set PAYROLL is created in sorted order by EmployeeIDNumber.

The answer is (a). Without using the (out=) option, the input data set is recreated in the sorted order. No new data set is created.

This item will ask you to provide a line of missing code; The SAS data set WORK.INPUT contains 10 observations, and includes the numeric variable Cost. The following SAS program is submitted to accumulate the total value of Cost for the 10 observations: data WORK.TOTAL; set WORK.INPUT; Total=Total+Cost; run; Which statement correctly completes the program? keep Total; retain Total 0; Total = 0; If _N_= 1 then Total = 0;

The answer is (b). In order to compute the total cost for the 10 observations, you must retain the cost from one observation (iteration) to the next. The RETAIN statement does the job.

Which one of the following SAS date formats displays the SAS date value for January 16, 2002 in the form of 16/01/2002? a. DATE10. b. DDMMYY10. c. WEEKDATE10. ​d. DDMMYYYY10.

The answer is (b). The (DDMMYY10.) format displays the date in the form of '16/01/2002'.

The SAS data set named COMPANY.PRICES is listed below: COMPANY.PRICES prodid price producttype sales returns K12S 5.10 NETWORK 15 2 B132S 2.34 HARDWARE 300 10 R18KY2 1.29 SOFTWARE 25 5 3KL8BY 6.37 HARDWARE 125 15 DY65DW 5.60 HARDWARE 45 5 DGTY23 4.55 HARDWARE 67 2 The following SAS program is submitted: libname company 'SAS-data-library'; data hware inter soft; set company.prices (keep = producttype price); if price le 5.00; if producttype = 'HARDWARE' then output HWARE; else if producttype = 'NETWORK' then output INTER; else if producttype = 'SOFTWARE' then output SOFT; run; How many observations does the HWARE data set contain? A. 0 B. 2 C. 4 D. 6

The answer is (b). The (if price le 5.00) statement first ignores all of the items that are more expensive than $5. The K12S, 3KL8BY and DY65DW items are ignored. Out of the three products left, only two of them are HARDWARE: B132S 2.34 HARDWARE 300 10 DGTY23 4.55 HARDWARE 67 2 The HWARE data set contains only two observations.

The following SAS program is submitted: ods csvall file='c:test.csv'; proc print data=WORK.ONE; var Name Score Grade; by IdNumber; run; ods csvall close; What is produced as output? A. A file named test.csv that can only be opened in Excel. B. A text file named test.csv that can be opened in Excel or in any text editor. C. A text file named test.csv that can only be opened in a text editor. D. A file named test.csv that can only be opened by SAS.

The answer is (b). The CSV file created is a text file that can be opened by Excel or any text editor.

Question 6: The following SAS program is submitted: b proc format; value score 1 - 50 = 'Fail' 51 - 100 = 'Pass'; run; Which one of the following PRINT procedure steps correctly applies the format? Options: A. proc print data = SASUSER.CLASS; var test; format test score; run; B. proc print data = SASUSER.CLASS; var test; format test score.; run; C. proc print data = SASUSER.CLASS format = score; var test; run; D. proc print data = SASUSER.CLASS format = score.; var test; run;

The answer is (b). The FORMAT statement should be used to apply the format to the TEST variable.

Given the SAS data set WORK.EMP_NAME: Name EmpID Jill 1864 Jack 2121 Joan 4698 John 5463 Given the SAS data set WORK.EMP_DEPT: EmpID Department 2121 Accounti 3567 Finance 4698 Marketin 5463 Accounti The following program is submitted: data WORK.ALL; merge WORK.EMP_NAME(in=Emp_N) WORK.EMP_DEPT(in=Emp_D); by Empid; if (Emp_N and not Emp_D) or (Emp_D and not Emp_N); run; How many observations are in data set WORK.ALL after submitting the program? A. 1 B. 2 C. 3 D. 5

The answer is (b). The IF statement in this question keeps only the mismatched observations between the two data sets. The mismatched observations are from ID (1864) from the EMP_NAME data set and ID (3567) from the EMP_DEPT data set. The output data set contains two observations.

The following SAS program is submitted at the start of a new SAS session: libname sasdata 'SAS-data-library'; data sasdata.sales; set sasdata.salesdata; profit=expenses-revenues; run; proc print data=sales; run; The SAS data set Sasdata.Salesdata has ten observations. Which one of the following explains why a report fails to generate? a. The DATA step fails execution. b. The SAS data set Sales does not exist. c. The SAS data set Sales has no observations. d. The PRINT procedure contains a syntax error.

The answer is (b). The SALES data set created in the data step is stored in the SASDATA library. However the PRINT procedure references the data set in the Work library, which does not exist.

Which one of the following SAS statements renames two variables? A. set work.dept1 work.dept2(rename = (jcode = jobcode) (sal = salary)); B. set work.dept1 work.dept2(rename = (jcode = jobcode sal = salary)); C. set work.dept1 work.dept2(rename = jcode = jobcode sal = salary); D. set work.dept1 work.dept2(rename = (jcode jobcode) (sal salary));

The answer is (b). The code in (b) contains the correct syntax.

In the following SAS program, the input data files are sorted by the NAMES variable: libname temp 'SAS-data-library'; data temp.sales; merge temp.sales work.receipt; by names; run; Which one of the following results occurs when this program is submitted? A. The program executes successfully and a temporary SAS data set is created. B. The program executes successfully and a permanent SAS data set is created. C. The program fails execution because the same SAS data set is referenced for both read and write operations. D. The program fails execution because the SAS data sets on the MERGE statement are in two different libraries. Click Coment link to see answer.

The answer is (b). The data set created is TEMP.SALES. This is a permanent data set saved in the TEMP library. Note: the same data set can be referenced in both read and write operations. Data sets can also be merged even when they are from different libraries. Hence, (c) and (d) are not correct.

In the following SAS program, the input data files are sorted by the NAMES variable: libname temp 'SAS-data-library'; data temp.sales; merge temp.sales work.receipt; by names; run; Which one of the following results occurs when this program is submitted? A. The program executes successfully and a temporary SAS data set is created. B. The program executes successfully and a permanent SAS data set is created. C. The program fails execution because the same SAS data set is referenced for both read and write operations. D. The program fails execution because the SAS data sets on the MERGE statement are in two different libraries.

The answer is (b). The data set is created in the TEMP library which is a permanent library.

A raw data file is listed below: RANCH,1250,2,1,Sheppard Avenue,"$64,000" SPLIT,1190,1,1,Rand Street,"$65,850" CONDO,1400,2,1.5,Market Street,"80,050" TWOSTORY,1810,4,3,Garris Street,"$107,250" RANCH,1500,3,3,Kemble Avenue,"$86,650" SPLIT,1615,4,3,West Drive,"94,450" SPLIT,1305,3,1.5,Graham Avenue,"$73,650" The following SAS program is submitted using the raw data file as input: data work.condo_ranch; infile 'file-specification' dsd; input style $ @; if style = 'CONDO' or style = 'RANCH'; input sqfeet bedrooms baths street $ price : dollar10.; run; How many observations will the output data set contain? A. 0 B. 3 C. 5 D. 7

The answer is (b). The first INPUT statement reads the STYLE column, which contains seven observations. However, the IF statement below the INPUT statement subsets the data set. Only the STYLE matching "RANCH" and "CONDO" are kept in the data set. Only three observations are kept in the output.

A SAS PRINT procedure output of the WORK.LEVELS data set is listed below: Obs name level 1 Frank 1 2 Joan 2 3 Sui 2 4 Jose 3 5 Burt 4 6 Kelly . 7 Juan 1 The following SAS program is submitted: data work.expertise; set work.levels; if level = . then expertise = 'Unknown'; else if level = 1 then expertise = 'Low'; else if level = 2 or 3 then expertise = 'Medium'; else expertise = 'High'; run; Which of the following values does the variable EXPERTISE contain? A. Low, Medium, and High only B. Low, Medium, and Unknown only C. Low, Medium, High, and Unknown only D. Low, Medium, High, Unknown, and ' ' (missing character value)

The answer is (b). The following expression is always true: else if level = 2 or 3 then expertise = 'Medium'; Burt's expertise is assigned as 'Medium' despite his level. The expertise 'High' would not be assigned to any observation.

The following SAS program is submitted: data allobs; set sasdata.origin (firstobs = 75 obs = 499); run; The SAS data set SASDATA.ORIGIN contains 1000 observations. How many observations does the ALLOBS data set contain? A. 424 B. 425 C. 499 D. 1000

The answer is (b). The number of observations equal to (OBS - FIRSTOBS + 1). It is (499 - 75 + 1) = 425.

The following SAS program is submitted: libname sasdata 'SAS-data-library'; data test; set sasdata.chemists; if jobcode = 'chem3' then description = 'Senior Chemist'; else description = 'Unknown'; run; A value for the variable JOBCODE is listed below: JOBCODE CHEM3 Which one of the following values does the variable DESCRIPTION contain? A. chem3 B. Unknown C. Senior Chemist D. ' ' (missing character value)C

The answer is (b). The value "Chem3" is different than "CHEM3". The description is set as "Unknown" as a result.

The SAS data sets WORK.EMPLOYEE and WORK.SALARY are listed below: WORK.EMPLOYEE WORK.SALARY fname age fname salary Bruce 30 Bruce 25000 Dan 40 Bruce 35000 Dan 25000 The following SAS program is submitted: data work.empdata; merge work.employee work.salary; by fname; totsal + salary; run; How many variables are output to the WORK.EMPDATA data set? A. 3 B. 4 C. 5 D. No variables are output to the data set as the program fails to execute

The answer is (b). There are, in total, four variables. The variables are FNAME, AGE, SALARY and TOTSAL.

The following SAS program is submitted: data work.sales; do year = 1 to 5; do month = 1 to 12; x + 1; end; end; run; Which one of the following represents how many observations are written to the WORK.SALES data set? A. 0 B. 1 C. 5 D. 60

The answer is (b). There is no OUTPUT statement within the do-loop. The loop executes 60 times. However, only the values from the last round of looping are written to the data set. Question 3:

When the following SAS program is submitted, the data set SASDATA.PRDSALES contains 5000 observations: Iibname sasdata 'SAS-data-Iibrary'; options obs = 500; proc print data = sasdata.prdsales (firstobs = 100); run; options obs = max; proc means data = sasdata.prdsales (firstobs = 500); run; How many observations are processed by each procedure? A. 400 for PROC PRINT 4500 for PROC MEANS B. 401 for PROC PRINT 4501 for PROC MEANS ​C. 401 for PROC PRINT 4500 for PROC MEANS D. 500 for PROC PRINT 5000 for PROC MEANS

The answer is (b). When both the (obs=) and (firstobs=) options are specified, the number of observations processed is: obs - firstobs + 1 The observations processed for the PRINT procedure is 500-100+1 = 401 The observations processed for the MEANS procedure is 5000-500+1 = 4501

The observations in the SAS data set WORK.TEST are ordered by the values of the variable SALARY. The following SAS program is submitted: proc sort data = work.test out = work.testsorted; by name; run; Which one of the following is the result of the SAS program? A. The data set WORK.TEST is stored in ascending order by values of the NAME variable. B. The data set WORK.TEST is stored in descending order by values of the NAME variable. C. The data set WORK.TESTSORTED is stored in ascending order by values of the NAME variable. D. The data set WORK.TESTSORTED is stored in descending order by values of the NAME variable.

The answer is (c). By default, the SORT procedure sorts the variable in ascending order. When using the (out=) option in the procedure, the input data set (i.e. TEST) remains unchanged.

A raw data file is listed below: --------10-------20-------30 squash 1.10 apples 2.25 juice 1.69 The following SAS program is submitted using the raw data file above: data groceries; infile 'file-specification'; input item $ cost; run; Which one of the following completes the program and produces a grand total for all COST values? A. grandtot = sum cost; B. grandtot = sum(grandtot,cost); C. retain grandtot 0; grandtot = sum(grandtot,cost); D. grandtot = sum(grandtot,cost); output grandtot;

The answer is (c). In order to compute the grand total cost of the groceries, you must first use the RETAIN statement on the GRANDTOT variable. You then use the SUM function to compute the cumulative summation for the total cost.

A raw data record is listed below: ----|----10---|----20---|----30 $23,456 750 The following SAS program is submitted using the raw data file as input: data bonus; infile 'file-specification'; input salary $ 1 - 7 raise 9 - 11; <insert statement here> run; Which one of the following statements completes the program and adds the values of SALARY and RAISE to calculate the expected values of the NEWSALARY variable? A. newsalary = salary + raise; B. newsalary = put(salary,comma7.) + raise; C. newsalary = input(salary,comma7.) + raise; ​D. newsalary = put(salary,comma7.) + put(raise,3.);

The answer is (c). In order to compute the new salary, the value from the SALARY variable (i.e. $23,456) must be first converted to a numeric value before adding it to the RAISE variable. This is done by using the INPUT function with the (comma7.) informat.

The following SAS program is submitted: data work.test; Author = 'Agatha Christie'; First = substr(scan(author,1,' ,'),1,1); run; Which one of the following is the length of the variable FIRST in the output data set? A. 1 B. 6 C. 15 D. 200

The answer is (c). The AUTHOR variable contains 15 characters. It has a length of 15. The variable created by the SCAN function will have the same length as the variable being scanned. The same is true for the SUBSTR function. As a result, the FIRST variable will have the same length as the AUTHOR variable, which is 15. **Note: in earlier versions of SAS, the SCAN function returns a variable that has a default length of 200. The answer for this question used to be (d). However, with the newer version of SAS, this is no longer correct.

The following SAS program is submitted: data work.sets; do until (prod gt 6); prod + 1; end; run; Which one of the following is the value of the variable PROD in the output data set? A. 5 B. 6 C. 7 D. 8

The answer is (c). The DO UNTIL statement continues the loop until the condition (prod gt 6) is true. The loop ends when PROD is greater than six (which is seven).

The data set WORK.REALESTATE has the variable LocalFee with a format of 9. and a variable CountryFee with a format of 7.; The following SAS program is submitted: data WORK.FEE_STRUCTURE; format LocalFee CountryFee percent7.2; set WORK.REALESTAT; LocalFee=LocalFee/100; CountryFee=CountryFee/100; run; What are the formats of the variables LOCALFEE and COUNTRYFEE in the output dataset? A. LocalFee has format of 9. and CountryFee has a format of 7. B. LocalFee has format of 9. and CountryFee has a format of percent7.2 C. Both LocalFee and CountryFee have a format of percent7.2 D. The data step fails execution; there is no format for LocalFee.

The answer is (c). The FORMAT statement overwrites the original formats assigned to the LOCALFEE and COUNTRYFEE variables. Both variables have a format of (percent7.2).

The following SAS program is submitted: data work.new; mon = 3; day = 23; year = 2000; date = mdy(mon,day,year); run; Which one of the following is the value of the DATE variable? A. a character string with the value '23mar2000' B. a character string with the value '03/23/2000' C. a numeric value of 14692, which represents the SAS date value for March 23, 2000 D. a numeric value of 3232000, which represents the SAS date value for March 23, 2000

The answer is (c). The MDY() function returns the SAS date constant for the date of March 23, 2000. It is 14692.

The following program is submitted: data test; average = mean(6,4,.,2); run; What is the value of the variable AVERAGE? A. 0 B. 3 C. 4 ​D. . (missing numeric value)

The answer is (c). The MEAN function ignores the missing value when computing the data average. The mean is (6+4+2)/3 = 4.

Which one of the following is true of the RETAIN statement in a SAS DATA step program? A. It can be used to assign an initial value to _N_ . B. It is only valid in conjunction with a SUM function. C. It has no effect on variables read with the SET, MERGE and UPDATE statements. D. It adds the value of an expression to an accumulator variable and ignores missing values.

The answer is (c). The RETAIN statement has no effect on variables read with the SET, MERGE and UPDATE statements.

Consider the following data step: data WORK.NEW; set WORK.OLD; Count+1; run; The variable Count is created using a sum statement. Which statement regarding this variable is true? A. It is assigned a value 0 when the data step begins execution. B. It is assigned a value of missing when the data step begins execution. C. It is assigned a value 0 at compile time. D. It is assigned a value of missing at compile time

The answer is (c). The SUM statement has an implied RETAIN statement that initializes the variable with the value (0). The value is assigned to the variable during the compilation phase, not the execution phase.

Which one of the following is true of the SUM statement in a SAS DATA step program? A. It is only valid in conjunction with a SUM function. B. It is not valid with the SET, MERGE and UPDATE statements. C. It adds the value of an expression to an accumulator variable and ignores missing values. D. It does not retain the accumulator variable value from one iteration of the SAS DATA step to the next.

The answer is (c). The SUM statement is equivalent to using the RETAIN statement and the SUM function. It adds the value to an accumulator and ignores the missing value.

The following SAS program is submitted: data work.report; set work.sales_info; if qtr(sales_date) ge 3; run; The SAS data set WORK.SALES_INFO has one observation for each month in the year 2000 and the variable SALES_DATE which contains a SAS date value for each of the twelve months. How many of the original twelve observations in WORK.SALES_INFO are written to the WORK.REPORT data set? A. 2 B. 3 C. 6 D. 9

The answer is (c). The data set contains one observation for each month in 2000. There are 12 observations in total. The QTR() function subsets the data set and keeps only the observations where the quarter is greater than or equal to (i.e. GE) 3. This keeps only the observations that fall into the third and fourth quarters of the year. There are six observations kept in the data set.

Given the SAS data set WORK.TEMPS: Day Month Temp 1 May 75 15 May 70 15 June 80 3 June 76 2 July 85 14 July 89 The following program is submitted: proc sort data=WORK.TEMPS; by descending Month Day; run; proc print data=WORK.TEMPS; run; Which output is correct? A. Obs Day Month Temp 1 2 July 85 2 14 July 89 3 3 June 76 4 15 June 80 5 1 May 75 6 15 May 70 B. Obs Day Month Temp 1 1 May 75 2 2 July 85 3 3 June 76 4 14 July 89 5 15 May 70 6 15 June 80 C. Obs Day Month Temp 1 1 May 75 2 15 May 70 3 3 June 76 4 15 June 80 5 2 July 85 6 14 July 89 D. Obs Day Month Temp 1 15 May 70 2 1 May 75 3 15 June 80 4 3 June 76 5 14 July 89 6 2 July 85

The answer is (c). The data set is sorted by DAY in ascending order within the MONTH in descending order. The MONTH variable is a character variable. The order of the MONTH should be May followed by June and July. The first two observations in the output are: 1 May 75 15 May 70

The following SAS program is submitted: proc sort data=work.employee; by descending fname; proc sort data=work.salary; by descending fname; data work.empdata; merge work.employee work.salary; by fname; run; Which one of the following statements explains why the program failed execution? A. The SORT procedures contain invalid syntax. B. The merged data sets are not permanent SAS data sets. C. The data sets were not merged in the order by which they were sorted. D. The RUN statements were omitted after each of the SORT procedures.

The answer is (c). The two input data sets are not sorted by the FNAME variable before being merged. This causes a syntax error.

Which step displays a listing of all the data sets in the WORK library? A. proc contents lib=WORK run; B. proc contents lib=WORK.all;run; C. proc contents data=WORK._all_; run; D. proc contents data=WORK _ALL_; run;

The answer is (c). The work._all_ is the correct syntax when using it in the CONTENTS procedure.

Given the existing SAS program: proc format; value agegrp low-12 ='Pre-Teen' 13-high = 'Teen'; run; proc means data=SASHELP.CLASS; var Height; class Sex Age; format Age agegrp.; run; Which statement in the proc means step needs to be modified or added to generate the following results: Analysis Variable : Height Sex Age N Obs Minimum Maximum Mean F Pre-Teen 3 51.3 59.8 55.8 Teen 6 56.5 66.5 63.0 M Pre-Teen 4 57.3 64.8 59.7 Teen 6 62.5 72.0 66.8 A. var Height / nobs min max mean maxdec=1; B. proc means data=SASHELP.CLASS maxdec=1 ; C. proc means data=SASHELP.CLASS min max mean maxdec=1; D. output nobs min max mean maxdec=1;

The answer is (c). There are two things you need to do to get the results displayed. 1. Specify the three statistics computed in the output, which are minimum, maximum and mean. 2. Specify the (maxdec=1) option to display the statistics with one decimal place.

The SAS data set SASUSER.HOUSES contains a variable PRICE which has been assigned a permanent label of "Asking Price". Which one of the following SAS programs temporarily replaces the label "Asking Price" with the label "Sale Price" in the output? A. proc print data = sasuser.houses; label price = "Sale Price"; run; B. proc print data = sasuser.houses label; label price "Sale Price"; run; C. proc print data = sasuser.houses label; label price = "Sale Price"; run; D. proc print data = sasuser.houses label = "Sale Price"; run;

The answer is (c). When displaying the label column in the output, you must specify both the LABEL option and the LABEL statement in the PRINT procedure.

The SAS data set EMPLOYEE_INFO is listed below: IDNumber Expenses 2542 100.00 3612 133.15 2198 234.34 2198 111.12 The following SAS program is submitted: proc sort data = employee_info; run; Which one of the following BY statements completes the program and sorts the data sequentially by descending expense values within each descending IDNUMBER value? A. by descending IDNumber Expenses; B. by (IDNumber Expenses) descending; C. by IDNumber descending Expenses descending; D. by descending IDNumber descending Expenses;

The answer is (d). Both the IDNUMBER and EXPENSES have to be sorted in descending order. The 'descending' keyword must be added to each variable in the BY statement.

A raw data record is listed below: --------10-------20-------30 1999/10/25 The following SAS program is submitted: data projectduration; infile 'file-specification'; input date $ 1 - 10; run; Which one of the following statements completes the program above and computes the duration of the project in days as of today's date? A. duration = today( ) - put(date,ddmmyy10.); B. duration = today( ) - put(date,yymmdd10.); C. duration = today( ) - input(date,ddmmyy10.); D. duration = today( ) - input(date,yymmdd10.);

The answer is (d). In order to compute the duration, you must first convert the DATE variable to the numeric SAS date constant. This can be done by using the INPUT function. The date text value is stored in the form of '1999/10/25'. This matches the form of the (yymmdd10.) informat.

The following SAS program is submitted: data work.test; First = 'Ipswich, England'; City = substr(First,1,7); City_Country = City!!', '!!'England'; run; Which one of the following is the value of the variable CITY_COUNTRY in the output data set? A. Ipswich!! B. Ipswich, England C. Ipswich, 'England' D. Ipswich , England

The answer is (d). The CITY variable contains the value 'Ipswich'. However, it also has a length of 16. SAS automatically added nine trailing spaces to the variable. The CITY_COUNTRY variable will have spaces added between 'Ipswich' and the comma':

The following SAS program is submitted: data work.clients; calls = 6; do while (calls le 6); calls + 1; end; run; Which one of the following is the value of the variable CALLS in the output data set? A. 4 B. 5 C. 6 D. 7

The answer is (d). The DO WHILE statement continues the loop for as long as the condition (calls le 6) is true. The loop ends when calls is greater than six (which is seven).

Which action assigns a reference named SALES to a permanent SAS data library? a. Issuing the command: libref SALES 'SAS-data-library' b. Issuing the command: libname SALES 'SAS-data-library' c. Submitting the statement: libref SALES 'SAS-data-library'; ​d. Submitting the statement: libname SALES 'SAS-data-library';

The answer is (d). The LIBNAME statement should be submitted to create a permanent library in SAS.

Which of the following choices is an unacceptable ODS destination for producing output that can be viewed in Microsoft Excel? A. MSOFFICE2K B. EXCELXP C. CSVALL D. WINXP

The answer is (d). The ODS destinations that can be opened with an Excel spreadsheet are CSVALL, MSOFFICE2K and EXCELXP. WINXP is not a valid ODS destination.

Which one of the following SAS DATA steps saves the temporary data set named MYDATA as a permanent data set? A. libname sasdata 'SAS-data-library'; data sasdata.mydata; copy mydata; run; B. libname sasdata 'SAS-data-library'; data sasdata.mydata; keep mydata; run; C. libname sasdata 'SAS-data-library'; data sasdata.mydata; save mydata; run; D. libname sasdata 'SAS-data-library'; data sasdata.mydata; set mydata; run;

The answer is (d). The SET statement saves the data set in the permanent SASDATA library.

The SAS data set WORK.ONE contains a numeric variable named Num and a character variable named Char: Num Char 1 23 2 23 1 77 The following SAS program is submitted: proc print data=WORK.ONE; where Num='1′; run; What is output? A. Obs Num Char 1 1 23 B. Obs Num Char 1 1 23 3 1 77 C. Obs Num Char 1 1 23 2 2 23 3 1 77 D. No output is generated.

The answer is (d). The character value '1' is specified in the WHERE statement where a numeric value is required. This causes a syntax error and no output is produced.

Assume that SAS data sets Sasdata.Products and Sasdata.Sales both contain the Prod_ID variable. Which of the following SAS DATA steps returns only exceptions or non matches? a. libname sasdata 'SAS-data-library'; data all; merge sasdata.products sasdata.sales; by prod_id; if ins=1 or inp=1; run; b. libname sasdata 'SAS-data-library'; data all; merge sasdata.products(in=inp) sasdata.sales(in=ins); by prod_id; if ins=1 and inp=1; run; c. libname sasdata 'SAS-data-library'; data all; merge sasdata.products(in=inp) ​ sasdata.sales(in=ins); by prod_id; if ins=0 and inp=0; run; d. ​libname sasdata 'SAS-data-library'; data all; merge sasdata.products(in=inp) sasdata.sales(in=ins); by prod_id; if ins=0 or inp=0; run;

The answer is (d). The condition that identifies the non-matches are: if ins=0 or inp=0;

The following SAS program is submitted: <insert ODS statement here> proc means data = sasuser.shoes; where product in ('Sandal' , 'Slipper' , 'Boot'); run; Which one of the following ODS statements completes the program and sends the report to an HTML file? A. ods html = 'sales.html'; B. ods file = 'sales.html'; C. ods file html = 'sales.html'; ​D. ods html file = 'sales.html';

The answer is (d). The correct ODS statement is: ods html file='sales.html';

Consider the following data step: data WORK.TEST; set SASHELP.CLASS(obs=5); retain City 'Beverly Hills'; State='California'; run; The computed variables City and State have their values assigned using two different methods, a RETAIN statement and an Assignment statement. Which statement regarding this program is true? A. The RETAIN statement is fine, but the value of City will be truncated to 8 bytes as the LENGTH statement has been omitted. B. Both the RETAIN and assignment statement are being used to initialize new variables and are equally efficient. Method used is a matter of programmer preference. C. The assignment statement is fine, but the value of City will be truncated to 8 bytes as the LENGTH statement has been omitted. D. City's value will be assigned one time, State's value 5 times.

The answer is (d). The data is not truncated in either the assignment statement or the RETAIN statement. The RETAIN statement is more efficient because the value is assigned to the variable only once in the initial data step iteration. On the other hand, the assignment statement assigns the value to the STATE variable five times as opposed to just once.

The SAS data set QTR1_REVENUE is listed below: destination revenue YYZ 53634 FRA 62129 FRA 75962 RDU 76254 YYZ 82174 The following SAS program is submitted: proc sort data = qtr1_revenue; by destination descending revenue; run; Which one of the following represents the first observation in the output data set? A. destination revenue YYZ 82174 B. destination revenue YYZ 53634 C. destination revenue FRA 62129 D. destination revenue FRA 75962

The answer is (d). The data set is sorted by REVENUE in descending order within each DESTINATION values in ascending order. The first observation should have the 'FRA' as the destination followed by the higher revenue of the two, which is 75962.

A raw data file is listed below: RANCH,1250,2,1,Sheppard Avenue,"$64,000" SPLIT,1190,1,1,Rand Street,"$65,850" CONDO,1400,2,1.5,Market Street,"80,050" TWOSTORY,1810,4,3,Garris Street,"$107,250" RANCH,1500,3,3,Kemble Avenue,"$86,650" SPLIT,1615,4,3,West Drive,"94,450" SPLIT,1305,3,1.5,Graham Avenue,"$73,650" The following SAS program is submitted using the raw data file as input: data work.condo_ranch; infile 'file-specification' dsd; input style $ @; if style = 'CONDO' or style = 'RANCH' then input sqfeet bedrooms baths street $ price : dollar10.; run; How many observations does the WORK.CONDO_RANCH data set contain? A. 0 B. 3 C. 5 D. 7

The answer is (d). The first INPUT statement reads the STYLE column, which contains seven observations. All seven observations are kept in the data set.

The following SAS program is submitted:data work.passengers; data work.passengers; if OrigPassengers = . then OrigPassengers = 100; TransPassengers = 100; OrigPassengers = .; NonPaying = 10; TotalPassengers = OrigPassengers + TransPassengers; run; Which one of the following is the value of the TOTALPASSENGERS variable in the output data set? A. 100 B. 110 C. 200 D. . (missing numeric value)

The answer is (d). The missing value will cause the summation to fail. The TOTALPASSENGERS variable will contain a missing value.

The following SAS program is submitted: data work.test; First = 'Ipswich, England'; City_Country = substr(First,1,7)!!', '!!'England'; run; Which one of the following is the length of the variable CITY_COUNTRY in the output data set? A. 6 B. 7 C. 17 D. 25

The answer is (d). The variable created by the SUBSTR function will have the same length as the variable that the value is extracted from. The value returned by [Substr(First, 1, 7)] will be 16. The CITY_COUNTRY variable will have a length of 16 + 2 + 7 = 25.

The SASDATA.BANKS data set has five observations when the following SAS program is submitted: libname sasdata 'SAS-data-library'; data allobs; set sasdata.banks; capital=0; do year = 2000 to 2020 by 5; capital + ((capital+2000) * rate); output; end; run; How many observations will the ALLOBS data set contain? A. 5 B. 15 C. 20 D. 25

The answer is (d). There are five observations from the BANK data set. The loop runs for five times. There will be 5 x 5 = 25 observations in the output data set.

What does the execution phase look like?

The data is read into the input buffer, and subsequently the PDV and the data set, one observation at a time

What does the double trailing (@@) do and where should it be placed?

The double trailing @ can be used to import data for a file that contains multiple blocks of data in a single record. Filename FN '/folders/myfolders/text/list13.txt'; Data DS; Infile FN DSD; Input Name $ Age Gender $ @@; Run; Two @@ hold the raw data record across iterations of the data step.

The following SAS DATA step is submitted: data sasdata.atlanta sasdata.boston work.portland work.phoenix; set company.prdsales; if region = 'NE' then output boston; if region = 'SE' then output atlanta; if region = 'SW' then output phoenix; if region = 'NW' then output portland; run; Which one of the following is true regarding the output data sets? A. No library references are required. B. The data sets listed on all the IF statements require a library reference. C. The data sets listed in the last two IF statements require a library reference. D. The data sets listed in the first two IF statements require a library reference.

The following SAS DATA step is submitted: data sasdata.atlanta sasdata.boston work.portland work.phoenix; set company.prdsales; if region = 'NE' then output boston; if region = 'SE' then output atlanta; if region = 'SW' then output phoenix; if region = 'NW' then output portland; run; Which one of the following is true regarding the output data sets? A. No library references are required. B. The data sets listed on all the IF statements require a library reference. C. The data sets listed in the last two IF statements require a library reference. D. The data sets listed in the first two IF statements require a library reference.

What does the pagesize and linesize options specify of the output table? options pagesize=15 linesize=64; Proc print data=sashelp.cars; Run;

The height and the width of the output table. Height is 15 and width is 64.

What is the difference between KEEP,DROP, RENAME statements compared to the options?

The keep, drop, rename statements affect only the output data sets. Data Class; Set SASHelp.class; Keep Name Age Height; Rename Height=Hgt_m; Run; Also no equal sign in statement compared to option.

What is the smallest value in SAS?

The missing value

What is variable length?

The number of bytes assigned to the variable

What happens when the following code runs: Filename FN '/folders/myfolders/text/col6.txt'; Data DS; Infile FN firstobs=2; Input @1 Num1 2. @5 Num2 2; Run;

The second 2 is missing a period. When this happens, the pointer control first moves to @5 to read in the Num2 variable. However, because the 2 is missing the period, it moves to the second position instead and reads that values @2 instead. It will give you a dataset, but it just will not be the correct one. Without a period, a numeric informat will become the column identifier from Column Input.

What is the length of the variable Name below? Data Student1; Name = "Amber"; Run; Data Student_all; Set Student1; Length Name $ 8; Run;

The variable length is still 5

What is the PDV set as?

The variables created by the INPUT statement is reset to missing. Then the data is read from the input buffer to the PDV. SAS resets the values in the PDV prior to reading in the second record.

What is the purpose of DO-END statements?

They can be used to conditionally execute more than one statement in the data step.

What is the purpose of format?

To change the display of the data values.

How do you import data where the values in the column is $1,200?

Use DollarW.D informat. We could use dollar6. for the $1200 example.

How to conditionally process the INPUT statement

Use If statement. Example: Filename FN '/folders/myfolders/text/list12.txt'; Data DS; Infile FN DSD; Input Name $ @; If name = "Mary" then input Age Gender $; Run;

What does the RETAIN statement do?

Used to retain the variable value from one iteration to the next. It prevents SAS from resetting the value to missing at the end of each data step iteration. RETAIN has no effect on the _n_ and error variables. The RETAIN statement has no effect on variables read with the SET and MERGE statements.

What is the list input method?

Used when importing delimited files that contain data separated by a delimiter.

What happens when you concatenate a character value with a numeric value using ||?

When attempting to concatenate a character value with a numeric value using the double stroke (||), SAS automatically converts the numeric value to a character value before concatenating the values. The conversion is made using the (best12.) format. The converted character value is right-aligned. If the converted value does not have 12 characters, there will be leading spaces added to the value.

What does termstr=CRLF; do?

When exporting to a standard Notepad, the data will look as though it's all in one line. To avoid this issue, you use termstr = CRLF

What do you need when are conditionally process in the INPUT statement when importing the data?

When the data step involves multiple INPUT statements, the single trailing @ must be used. Filename FN '/folders/myfolders/text/col7.txt'; Data DS; Infile FN firstobs=2; Input Name $ 1-4 @; If Name = "Amy" then input id 7-8; Else input id 10-11; Run; The single trailing @ at the end of the INPUT statement prevents the input pointer from going to the next data record.

Does it matter whether to use the KEEP option on the input or output data set?

Yes! When using the KEEP option on the input data set, you can keep only the variables that already exist in the data set. Keeping a variable that does not exist in the input data set will result in an error. Data Class (keep=name height Hgt_m); Set SASHelp.class; Hgt_m = height*0.0254; Run; ^^This is correct Data Class; Set SASHelp.class (keep=name height Hgt_m); Hgt_m = height*0.0254; Run; ^^ This is incorrect as the Hgt_m is a new variable and is not recognized in the SET statement.

How do you create a double-spaced file? (Exporting)

You add an additional PUT statement. Data _null_; Set Profile; File '/folders/myfolders/output1.txt' termstr=CRLF; Put @1 Name $8. @10 Age 2.; Put; Run;

What is something to keep in mind regarding fileref in INFILE statement?

You do not need to enclose the fileref with quotations when referencing it in the INFILE statement. Good Infile FN; Bad Infile 'FN';

What does NODS option do in the Proc Contents statement?

You only print out the list of data sets in the Proc Content output instead of printing out the descriptor information for each data set.

How do you concatenate character values in SAS?

You would you || or !! For instance: Data Temp; Input Text1 :$3. Text2 :$3.; Datalines; ABC DEF 123 456 !!! ### ; Run; Data Temp2; set temp; Comb = text1 || text2; Run; Will create Comb = ABCDEF 123456 !!!###

PDV contains two automatic variables

_n_ and _error_

The following SAS program is submitted: footnote1 'Sales Report for Last Month'; footnote2 'Selected Products Only'; footnote3 'All Regions'; footnote4 'All Figures in Thousands of Dollars'; proc print data = sasuser.shoes; footnote2 'All Products'; run; Which footnote(s) is/are displayed in the report? A. All Products B. Sales Report for Last Month All Products C. All Products All Regions All Figures in Thousands of Dollars ​D. Sales Report for Last Month All Products All Regions ​All Figures in Thousands of Dollars

b

Which of the following SAS REPORT procedure options controls how column headings are displayed over multiple lines? A. BREAK= B. SPLIT= C. LABEL= D. SPACE=

b

What delimiters does SCAN use to identify words?

blank ! $ % & ( ) * + , - . / ; < ^ E.g. Word1,Word2,Word3 Word1 Word2 Word3 Word1!Word2!Word3 data Test; Title = 'A Tale of Two Cities, Charles J. Dickens'; Word = scan(title, 3, ','); run; SAS will return a blank with the above code. data Test; Title = 'A Tale of Two Cities, Charles J. Dickens'; Word = scan(title, 3, ', '); run; Notice there is a space after the COMMA! SAS will use both the space and the comma as delimiters. Please note that the variable created by the SCAN function has the same length as the variable being scanned.

Which TITLE statement would display JANE'S DOG as the text of the title? A. title "JANE"S DOG"; B. title 'JANE"S DOG'; C. title "JANE'S DOG"; D. title 'JANE' ' 'S DOG';

c

What is one of the downsides of using column input?

informat cannot be assigned to the variable. For instance, date of birth, if listed as DDMMMYYYY; it would need to be imported as a character variable. Thus, you cannot import non-standard values such as date, time, and dollar amount is a downside for column input.

How do you access a data set stored in SAS data library?

libname clinic 'd:\reports\lab\patient\data';

How to calculate number of observations processed when obs = and firstobs = are both used?

n = obs - firstobs + 1

what order when using cross tabulation table? proc freq data = sales; tables region * product run;

region is row, product is column.


Ensembles d'études connexes

Demand and Supply (How Markets Work)

View Set

Renaissance Inventions & Inventeurs

View Set

Functional Anatomy Quiz Questions (exam 2)

View Set