Module 8
True or False: Logic errors occur when program statements do not conform to the rules of the SAS language.
False
True or False: The END= option in the SET or INFILE statement indicates that SAS should process the last observation.
False
True or False: When a logic error occurs, SAS writes an error message to the log.
False
True or False: Logic errors are often more difficult to detect than syntax errors.
True
True or False: The END= option in the SET or INFILE statement creates a variable that acts as an end-of-file indicator.
True
True or False: When a logic error occurs, SAS displays unexpected results.
True
Select the statement that extracts and assigns the two-letter state abbreviation from Address2 to a new variable named State. a) State=scan(Address2,2) b) State=scan(Address2,13,2) c) State=substr(Address2,2) d) State=substr(Address2,13,2)
a) State=scan(Address2,2)
Which of the following functions can convert the values of the numeric variable Level to character values? a) put(Level,3.) b) input(3.,Level) c) put(3.,Level) d) input(Level,3.)
a) put(Level,3.)
Which function returns the greatest integer less than or equal to the argument? a) CEIL b) INT c) FLOOR
c) FLOOR
What is the new value of Code? Code="HNL:96701-006"; Code=substr(Code,1,length(Code)-4); a) 96701-006 b) HNL: c) HNL:96701 d) 1-006
c) HNL:96701
Which of the following is NOT a task of the PUTLOG statement? a) Write text to the log b) Write formatted values to the log c) Write all the logic errors to the log d) Write the values of all the variables to the log
c) Write all the logic errors to the log
Which of the following functions converts the character values of Base to numeric values? a) put(comma10.2,Base) b) put(Base,comma10.2) c) input(Base,comma10.2) d) input(comma10.2,Base)
c) input(Base,comma10.2)
The variable Title is 22 characters long. One of the values for Title is My House on the Lane. Which of the following statements would provide the full value of the variable in the log if the data included two leading spaces? a) putlog Title $quote20.; b) putlog Title $quote22.; c) putlog Title $quote30.;
c) putlog Title $quote30.;
The variable IDCode contains values such as 123FA and 321MB. The fourth character identifies gender. Select the statement that assigns this character code to a new variable named Gender. a) Gender=scan(IDCode,4) b) Gender=scan(IDCode,4,1) c) Gender=substr(IDCode,4) d) Gender=substr(IDCode,4,1)
d) Gender=substr(IDCode,4,1)
A typical value for the numeric variable SiteNum is 12.3. Which statement correctly converts the values of SiteNum to character values when creating the variable Location? a) Location=Dept||'/'||put(SiteNum,$3); b) Location=Dept||'/'||put(SiteNum,4); c) Location=Dept||'/'||put(SiteNum,3.1); d) Location=Dept||'/'||put(SiteNum,4.1);
d) Location=Dept||'/'||put(SiteNum,4.1);
Which function calculates the average of the variables Var1, Var2, Var3, and Var4? a) mean(Var1,Var4) b) mean(Var1-Var4) c) mean(of Var1,Var4) d) mean(of Var1-Var4)
d) mean(of Var1-Var4)