506 exam 2 practice questions
Is this a valid data step? data work.newstuff; set work.oldstuff; Total+Num; where Total < 100; run;
no
Is this valid format? value qtrfmt 1,2,3='First' 4,5,6='Second';
yes
Which statement is false concerning the sum statement? a. The sum statement ignores missing values. b. The sum statement initially sets the accumulator column to missing. c. The sum statements adds a numeric value to an accumulator column. d. The sum statement automatically retains the value of the accumulatingcolumn.
B
How would you concatenate ParkCode and Gate together with a hyphen? a. cats(ParkCode,Gate,-) b. catx(ParkCode,Gate,"-") c. catx("-",ParkCode, Gate)
c
Which of the below has valid syntax? A) call Sorted = sortn(Sunak, Mordaunt, Johnson); B) Sorted = call sortn(Sunak, Mordaunt, Johnson); C) call sortn(Sunak, Mordaunt, Johnson); D) Sorted = sortn(Sunak, Mordaunt, Johnson);
C
Which expression rounds each value of Sales to the nearest hundredth(or two decimal places)? a. round(Sales) b. round(Sales, 2) c. round(Sales, .01) d. round(Sales, dollar10.2)
C
Consider the program and data below. What is the value of Count after the third observation is read, if data goes 10,20, . ,40,50? data newnums; set nums; retain Count 100; Count+Tens; run;
130
Table one has 2 columns (A and B) and 100 rows. Table two has 3 columns (B, C, and D) and 200 rows. I concatenate these tables using the statement SET one two; The resulting concatenated table should have ______ columns and ______ rows.
4, 300
Which of the following functions can convert the values of the numeric variable Level to character values? a. put(Level, 3.) b. put(3., Level) c. input(3., Level) d. input(Level, 3.)
A
Which statement contains valid syntax for the RETAIN statement? a. retain year 2018; b. retain year*2018; c. retain year=2018; d. retain year{2018};
A
Which statement is false concerning the compilation phase of the DATAstep? a. Initial values are assigned to the columns. b. The program data vector (PDV) is created. c. The DATA step is checked for syntax errors. d. The descriptor portion of the output table is created.
A
Which statement is false? a. The KEEP statement names the columns to include from the input table. b. The DROP statement names the columns to exclude from the outputtable. c. The KEEP= option in the DATA statement names the columns to includein the output table. d. The DROP= option in the SET statement names the columns to excludefrom being read into the PDV.
A
Which statement is true concerning the execution phase of the DATAstep? a. Data is processed in the program data vector (PDV). b. An implied OUTPUT occurs at the top of the DATA step. c. An implied REINITIALIZE occurs at the bottom of the DATA step. d. Columns read from the input table are set to missing when SAS returnsto the top of the DATA step.
A
Which of the below has valid syntax? Question options: A) call Sorted = sortn(Sunak, Mordaunt, Johnson); B) Sorted = call sortn(Sunak, Mordaunt, Johnson); C) call sortn(Sunak, Mordaunt, Johnson); D) Sorted = sortn(Sunak, Mordaunt, Johnson);
C
Functions and CALL routines both return a value that must be used in an assignment statement or expression. a. True b. False
B
The DATA step debugger in SAS Enterprise Guide can be used with DATAand PROC steps. a. True b. False
B
Which DATA step statement indicates to continue processing the last rowof a BY group? a. if First.JobTitle; b. if Last.JobTitle; c. where First.JobTitle=1; d. where Last.JobTitle=1;
B
Which columns are required in an input table to create a format based on numeric ranges (for example, 1 through 100) through the CNTLIN= option? A) FORMAT, START, END, and NAME B) FMTNAME, START, END, and LABEL C) FMTNAME, START, and LABEL D) FORMAT, START, LAST, NAME, and TYPE
B
Which function calculates the average of the columns Week1, Week2,Week3, and Week4? a. mean(Week1, Week4) b. mean(Week1-Week4) c. mean(of Week1, Week4) d. mean(of Week1-Week4)
D
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
Which of these functions rounds each value of the numeric column weight to the nearest tenth (that is, to one decimal place)? A) round(weight) B) round(weight, comma10.1) C) round(weight, 0.1) D) round(weight, 1)
C
Which statement is not a compile-time-only statement? a. KEEP b. LENGTH c. SET d. WHERE
C
Which statement is false concerning the compilation phase of the DATA step? A) The descriptor portion of the output table is created. B) The program data vector (PDV) is created. C) The DATA step is checked for syntax errors. D) Initial values are assigned to the columns.
D
If you wanted to convert work.left to work.right (→) using a DATA step, which statement is needed to create multiple rows from a single row? A) NARROW B) WIDE C) RETAIN D) OUTPUT
D
Which step is not required when converting a character column namedDate to a numeric SAS date column with the same name? a. Rename the Date column to a new name, such as CharDate. b. Use the INPUT function to read the renamed CharDate charactercolumn and create a numeric column named Date. c. Specify an appropriate informat in the INPUT function.d. Format the new numeric Date column.
D
A table has only the numeric columns Var1, Var5, Var2, Var4, and Var3, and they are stored in that order for some infuriating reason. Which of the following statements will NOT work to calculate the mean of all 5 of those columns? A) avg=mean(of Var:); B)avg=mean(of Var1-Var5); C) avg=mean(of Var1--Var5); D) avg=mean(of _numeric_); E) None of the above (that is, all of these work)
E
When both creating AND applying a permanent custom format (that is, a custom format saved in a permanent location), which of the following needs to be done? A) Use the LIBRARY= option in a PROC FORMAT statement B) Use the FMTSEARCH= option in an OPTIONS statement C) Specify the name of the library in a FORMAT statement D) All of the above E) Just A and B
E
If you wanted to convert work.right to work.left (still ← again) using PROC TRANSPOSE instead, which of the following statements would you need to include? A)var Day; B)id Day; C)var Activity; D)id Activity; E)Both A and D F)Both B and C
F
By default, user-defined formats are stored in a temporary catalog named work.formats and are deleted at the end of your SAS session. a. True b. False
a
How would you control column input? a. set table(drop = col1) b. table (drop = col1)
a
How would you properly reset an accumulating column at the beginning of each new group? a. by cola; if last.cola=1 then accum_col =0; b. by cola; if first.cola=1 then accum_col =0; c. by cola; if first.cola=1 then first_col =0;
a
How would you subset output to only show the last row of each group? a. if last.col; b. if first.col; c. if last. col then do not output; d. if last.col=0 then output;
a
How would you use select and when to properly create 2 new tables? a. select(variable); when ('a') output first-table; when ('b') output second-table; b. select variable when first-table =1; output... c. if variable = 1 select first-table; output; if variable = 0 select second-table; output;
a
How would you write selected columns and values in the PDV to the log? a. putlog column=; b. putlog "column"; c. putlog _column_; d. putlog _all_;
a
I have a numeric column containing the value 100. After running the following step, I apply the format rates to that column in a PROC PRINT. How will that value of 100 be displayed? proc format;value rates 1-<100 = 'low' 100<-300 = 'high' other = 'out of range'; run; A)out of range B)100 C)high D)low
a
If you execute the following DATA step, which observations does the data set bonuses contain? data bonuses; merge managers(in=M) staff(in=S); by EmpID; if M=0 and S=1; run;; a. the observations from staff that have no match in managers b. the observations from managers that have no match in staff c. all observations from both managers and staff d. none of the above
a
Is a wide or narrow set better for proc freq? a. narrow b. wide
a
Is the following statement true? To create an accumulating total for a group, you first have to sort the data by the grouping variable(s). a. Yes b. No
a
Logic errors are often more difficult to detect than syntax errors. a. True b. False
a
The code for each school in a district starts with the first two letters of the street the school is located on. What function would you use to create a string that is only those first 2 letters? a. substr() b. scan() c. copbl()
a
The variable Address2 contains values such as Piscataway, NJ. Select the statement that extracts and assigns the two-letter state abbreviation 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
The variables FmtName, Start, and Label are required in order to create a format from a CNTLIN data set. a. True b. False
a
What does proc format cntlin = table; do? a. creates a custom format from an existing table named 'table' b. creates a format named cntlin c. opens all formats from the table library
a
What does compbl() do? a. Returns a character value with all multiple blanks in the string converted to single blanks b. Returns a character value with specified characters removed from the string c. Returns a character value with leading and trailing blanks removed from the string
a
What does strip() do? a. Returns a character value with leading and trailing blanks removed from the string b. Returns a character value with specified characters removed from the string c. Returns a character value with all multiple blanks in the string converted to single blanks
a
What is an easier way to do this: if name in ("Barbara", "James") then do; quiz1 =.; quiz2 = .; quiz3 = .; a. if name in ("Barbara","James") then call missing (of quiz:) b. if name = ("Barbara" or "James") then not missing (of quiz:) c. where name = Barbara or name = James; quiz = missing;
a
What is the correct syntax for proc format to create a format from a table and save it to a specific library? a. proc format cntlin = test library = myformats; run; b. proc format library = myformats fmtlib; c. data format; set old; format $myformat;
a
What is the difference between if and when statements? a. if can be used for new variables created in the same data step (when only with values from the input table) b. they're interchangeable c. if can be used only with values from the input table while when can be used for new variables created in the same data step
a
When a logic error occurs, SAS displays unexpected results. a. True b. False
a
When you submit the following program, what is listed in the log? data work.holdings; set work.catalog end=last; if _n_=1 then putlog 'books'; if last then do; putlog 'last of books'; putlog _all_; end; run; a. books, last of books, and the values for all the variables in the last observation b. books, last of books, and the values for all the variables in all observations c. the values of all the variables for the last observation
a
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
Which one of the following does not have proper syntax for specifying a range in the VALUE statement? a. 500>-700 b. 500-<700 c. 'A'-'C' d. 'Horse'-'Mouse'
a
Which statement is false concerning the compilation phase of the DATA step? a. Initial values are assigned to the columns. b. The program data vector (PDV) is created. c. The DATA step is checked for syntax errors. d. The descriptor portion of the output table is created.
a
Which statement is true concerning the execution phase of the DATA step? a. Data is processed in the program data vector (PDV). b. An implied OUTPUT occurs at the top of the DATA step. c. An implied REINITIALIZE occurs at the bottom of the DATA step. d. Columns read from the input table are set to missing when SAS returns to the top of the DATA step.
a
An iterative DO loop must have a stop value. a. True b. False
b
By default, the OUTPUT statement writes to only the first data set listed in the DATA statement. a. True b. False
b
Can 3 datasets be merged if there is no common column in each of the sets? a. yes b. no
b
Examine the following sum statement. Which statement is false? Total+Amount; a. The sum statement ignores missing values for Amount. b. The sum statement initially sets the Total column to missing. c. The sum statements adds the numeric value from Amount to the accumulator column, Total. d. The sum statement automatically retains the value of the Total column.
b
Given a column with values like $1000,$2000,$3500, etc, automatic conversion will happen: a. true b. false
b
How many times does the DO loop execute for the first iteration of the DATA step, if Years goes 5,3,4? data work.compare(drop=i); set finance.cdrates; Investment=5000; do i=1 to Years; Investment+Rate*Investment; end; run; a. 1 b. 5 c. 3 d. 4
b
How would you control column output? a. set table(drop = col1) b. table (drop = col1)
b
How would you create an output table named typfmtout from an existing format, $TypCode? a. proc format library = work cntlin = typfmtout; select $TypCode; b. proc format library = work cntlout = typefmtout; select $TypCode; c. proc format fmtsearch = $TypeCode; d. proc format cntlin format select typfmtout;
b
How would you write a text string or note to the log? a. putlog message=; b. putlog "message"; c. putlog _message_; d. putlog _all_;
b
If you submit the following program, which variables appear in the new data set? data falltryout; set school.sports(keep=Month Sport Coach); if Month="Aug"; drop Month; run; a. Month, Sport, Coach b. Sport, Coach c. none
b
In the FORMAT procedure, you specify the name of the format and the name of the column that will use the custom format. a. True b. False
b
In the VALUE statement in PROC FORMAT, you cannot nest formats by specifying the format that you are creating. Use a second format as the formatted value. a. True b. False
b
In which location can you not use a FORMAT? a. PUT statement b. TITLE statement c. FORMAT= option d. FORMAT statement
b
Logic errors occur when program statements do not conform to the rules of the SAS language. a. True b. False
b
What does data new; set old (obs=2); do? a. outputs 2 rows exactly b. reads in only 2 rows from old dataset c. creates 2 new observations
b
What does compress() do? a. Returns a character value with leading and trailing blanks removed from the string b. Returns a character value with specified characters removed from the string c. Returns a character value with all multiple blanks in the string converted to single blanks
b
What does floor() do? a. returns the smallest integer greater than or equal to the argument b. returns the largest integer that is less than or equal to the argument c. returns the integer value d. returns the values after a decimal
b
What function would be used to turn 17.256 -> 17? Or -3.73 to -4? a. ceil() b. floor() c. int() d. intn()
b
What happens when you submit the following code? data temperate tropical; set flora; output; run; a. Because the OUTPUT statement does not specify a data set, both output data sets are empty. b. All observations in the flora data set are written to both output data sets. c. The DATA step writes the first observation to each output data set and then stops processing because no RETURN statement is specified.
b
What is an example of when a narrow table would be necessary? a. calculate average scores for one student only b. calculate average for all test scores in a class
b
What statement can you use to explicitly say whatever is currently in the PDV? a. return b. output c. retain d. putlog
b
When a logic error occurs, SAS writes an error message to the log. a. True b. False
b
When creating a custom format in the FORMAT procedure, you specify the name of the format and the name of the column that will use the custom format. a. True b. False
b
When using the DATA step to go from a narrow table to a wide table, theKEEP statement is needed to hold values in the PDV across multipleiterations of the DATA step. a. True b. False
b
When using the DATA step to summarize grouped data, what is the first step in the process? a. Output the first observation of each BY group. b. Set the accumulating variable to zero at the start of each BY group. c. Increment the accumulating variable with a sum statement (automatically retains).
b
Which DATA step statement indicates to continue processing the last row of a BY group? a. if First.JobTitle; b. if Last.JobTitle; c. where First.JobTitle=1; d. where Last.JobTitle=1;
b
Which columns are required in an input table to create a format based on numeric ranges (for example, 1 through 100) through the CNTLIN= option? A)FORMAT, START, END, and NAME B)FMTNAME, START, END, and LABEL C)FMTNAME, START, and LABEL D)FORMAT, START, LAST, NAME, and TYPE
b
Which of the following LIBNAME statements correctly assigns the libref MyMusic to the file AllMusic.xls, which is stored in the Entertainment directory of the C: drive on the Windows operating environment? a. libname mymusic 'Allmusic.xls'; b. libname mymusic 'C:\Entertainment\Allmusic.xls'; c. libname mymusic 'C:\Entertainment\Allmusic'; d. libname mymusic 'C:\Entertainment\Allmusic' filetype='excel';
b
Which of the following data set options can be added to the MERGE statement to help identify data set contributors (that is, identify the matches)? a. OBS= b. IN= c. RENAME= d. MATCHES=
b
Which of the following statements contains valid syntax? a. do 1 to 10 by 2; b. do while (Year>2025); c. do until Earnings<=100000; d. do date='01JAN2019' to '31JAN2019';
b
Which of the following statements contains valid syntax? a. do 1 to 10 by 2; b. do while (Year>2025); c. do until Earnings<=100000; d. do date='01JAN2019' to '31JAN2019';
b
Which statement is false? a. The DO UNTIL loop executes until a condition is true. b. The DO WHILE loop always executes at least one time. c. The DO WHILE loop checks the condition at the top of the loop. d. The DO UNTIL loop checks the condition at the bottom of the loop.
b
Which statement is false? a. The DO UNTIL loop executes until a condition is true. b. The DO WHILE loop always executes at least one time. c. The DO WHILE loop checks the condition at the top of the loop. d. The DO UNTIL loop checks the condition at the bottom of the loop.
b
Which statement is true about the following program? data payroll.empmast; set payroll.employee; by gender jobcode; run; a. A change in the value of Last.JobCode causes the value of Last.Gender to change. b. A change in the value of Last.Gender causes the value of Last.JobCode to be set to 1. c. Both Last.JobCode and Last.Gender are stored in the new data set.
b
Which statement retains the value of Sales2Dte in the PDV across iterations of the DATA step? a. retain Sales2Dte=10; b. Sales2Dte+Total_Retail_Price; c. Sales2Dte=Sales2Dte+Total_Retail_Price;
b
Within the data set furn.bookcase, the variable Finish contains values such as ash, cherry, teak, and matte-black. Which of the following creates a subset of the data in which the values of Finish contain the string walnut? Make the search for the string case-insensitive. a. data work.bookcase; set furn.bookcase; if find(Finish,'walnut',I); run; b. data work.bookcase; set furn.bookcase; if find(Finish,'walnut','I')>0; run;
b
You can use a drop statement in a proc print step. a. true b. false
b
How many rows will be in the final table if work.airwide contains three rows? data work.airnarrow;set work.airwide; Month='Jan'; Air=Jan;output; Month='Feb';Air=Feb;output; Month='Mar';Air=Mar;output; keep Year Month Air; run; a. 3 b. 6 c. 9 d. 12
c
During each execution of the following DO loop, the value of Earned is calculated and is added to its previous value. How many times does this DO loop execute? data finance.earnings; Amount=1000; Rate=.075/12; do Month=1 to 12; Earned+(Amount+Earned)*Rate; end; run; a. 0 b. 1 c. 12 d. 13
c
How would you search for custom formats in your 2 most used folders, myformats and bestformats? a. proc format cntlin = myformats best formats; b. data format = myformats, bestformats c. libname pg2 "C:/PG2"; options fmtsearch=(myformats bestformats);
c
If you process a BY group that consists of a single observation, what are the correct values of First.BY-variable and Last.BY-variable? a. First.BY-variable=0 Last.BY-variable=0 b. First.BY-variable=1 Last.BY-variable=0 c. First.BY-variable=1 Last.BY-variable=1 d. First.BY-variable=0 Last.BY-variable=1
c
Suppose the empinfo.bonuses data set contains the variables ID, Name, Office, Manager, Location, and Amount. Specify a data set option in the MERGE statement below to use only the variables ID, Name, and Amount in the data set. data mergedata.emppay; merge sales.reps(rename=(office=OfficeNumber)) empinfo.sales empinfo.bonuses ___________________; by ID; run; a. (drop=ID Name Amount) b. (output ID Name Amount) c. (keep=ID Name Amount) d. (in=ID Name Amount)
c
The data set shipping contains 25 observations and 3 variables (Product, BoxSize, and Rate). How many observations and variables does the data set shippingzones have? data shippingzones; set shipping; Zone=1; output; Zone=2; Rate=(Rate*1.5); output; Zone=3; Rate=(Rate*1.5); output; run; a. 25 observations, 4 variables b. 75 observations, 3 variables c. 75 observations, 4 variables
c
The data sets ensemble.spring and ensemble.summer both contain a variable named Blue, and Blue is not the BY variable. Which program prevents the values of the variable Blue from being overwritten when you merge the two data sets? a. data ensemble.merged; merge ensemble.spring(keep=blue) ensemble.summer; by fabric; run; b. data ensemble.merged; merge ensemble.spring(blue=navy) ensemble.summer; by fabric; run; c. data ensemble.merged; merge ensemble.spring(rename=(blue=navy)) ensemble.summer; by fabric; run;
c
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
What are the 2 automatic columns created when proc transpose is used? a. name, length b. prefix, format c. name, prefix d. old, new
c
What does proc format fmtlib library = work; do? A. creates a format named library B. creates a format named work C. shows all the details of the formats in the work library D. clears all formats in the work library
c
What is a putlog statement similar to? a. sas studio b. sas manager c. interactive debugger
c
What is an example of when a wide table would be necessary? a. find frequency of scores for one class b. calculate average for all test scores in a class c. calculate GPA for one person
c
What is the correct way to process data in groups? a. 1. use a data step 2. proc sort b. 1. proc freq tables a*b c. 1. proc sort with by statement 2. data step with by statement
c
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
What is the search order that is used to locate the permanent format given the following OPTIONS statement? options fmtsearch=(orion.MyFmts); a. orion.MyFmts only b.work.formats→orion.MyFmts→library.formats→formats supplied by SAS c. formats supplied by SAS→work.formats→library.formats→orion.MyFmts d.orion.MyFmts→work.formats→library.formats→formats supplied by SAS
c
When creating a format with a range, what symbol do you want to use? a. > b. : c. < d. $
c
Where do first. and last. live? a. putlog b. log c. PDV d. library
c
Which PROC FORMAT statement option is used to create a permanent format? a. CNTLIN= b. FMTLIB= c. LIBRARY= d. CNTLOUT=
c
Which function returns the greatest integer less than or equal to the argument? a. CEIL b. INT c. FLOOR
c
Which of the following contains valid syntax for the FMTSEARCH=option? a. options fmtsearch=sashelp; b. options fmtsearch=sashelp.formats; c. options fmtsearch=(sashelp sashelp.fmts); d. options fmtsearch=[sashelp.fmts sashelp];
c
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
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
Which of the following statements contains valid syntax? a. do Age=10 to 14 and while (Weight<150); b. do week=1 to 52 do until (Mileage ge 2750); c. do Increase=5 to 10 while (temperature lt 102); d. do Year=2018 to 2028 or until (Earnings<=100000);
c
Which of these functions rounds each value of the numeric column weight to the nearest tenth (that is, to one decimal place)? A)round(weight) B)round(weight, comma10.1) C)round(weight, 0.1) D)round(weight, 1)
c
Which option in the PROC FORMAT statement specifies a library to storea custom format? a. CATALOG= b. FMTLIB= c. LIBRARY= d. STORE=
c
Which statement is false concerning the TRANSPOSE procedure? a. Columns are transposed into rows. b. By default, numeric columns are transposed. c. Use a BY statement to sort the data while transposing. d. Use a VAR statement to specifically specify the character and numeric columns to transpose.
c
Which statement is false regarding nested DO loops? a. Each DO statement must have a corresponding END statement. b. Each DO loop must have its own index variable. c. Each DO loop must use the same increment value. d. Each DO loop can contain iterated SAS statements.
c
Which statement is true regarding the iterative DO loop? DO index-column = start TO stop <BY increment> ; a. The start and stop values can be character or numeric values. b. If an increment value is not specified, the default increment is 0. c. The index column is incremented at the bottom of each DO loop. d. The index column is not in the final table unless specifically kept.
c
Which statement needs to be added to the DATA step to include only thelast row per Year in the output table? data work.airwide2(keep=Year Jan Feb Mar); set work.airnarrow;by Year;retain Jan Feb Mar;if Month='Jan' then Jan=Air; else if Month='Feb' then Feb=Air; else if Month='Mar' then Mar=Air; ... insert statement here ... run; a. output; b. if Last then output; c. if Last.Year=1 then output; d. if Last.Year=0 then output;
c
Which statement renames the existing column Location in work.travelas Destination? a. set vacations travel(rename=(Location=Destination)); b. set vacations(rename=(Location=Destination)) travel; c. set vacations travel(rename=(Destination=Location)); d. set vacations travel(rename(Destination=Location));
c
Which subsetting IF statement selects observations for subsequent processing only if all three input data sets contribute to the current observation? data merged.flowers; merge spring.roses(rename=(red=BrickRed) in=yellow) spring.lilacs(in=purple) spring.petunias(in=pink); by ID; _________________________ run; a. if yellow=1 and purple=1 or pink=1; b. if yellow=0 or purple=0 or pink=0; c. if yellow=1 and purple=1 and pink=1; d. if yellow=1 or purple=1 and pink=0;
c
You want to select the last word in a sentence. What function is the best? a. catx(a,-1) b. substr(a,-1) c. scan(a,-1) d. compbl(a,-1)
c
Based on this DATA step, how many observations are in the earnings data set? data earnings; Earned=0; do Count=1 to 12 ; Earned+(Amount+Earned)*(Rate/12); output; end; run; a. 0 b. 1 c. 6 d. 12 e. 13
d
Filling in the blanks in the code below, which of the following options would make this DO loop run exactly once? data myyard; ___________ _______________________ geese=geese+1; end;run; A)geese=5;do until(geese>10); B)geese=5;do while(geese<=10); C)geese=20;do while(geese<=10); D)geese=20;do until(geese>10);
d
How can you see all details of all the formats in a given library? A. options fmtsearch B. proc format cntlin C. libname format D. proc format fmtlib library = work
d
How would you write all columns and values in the PDV to the log? a. putlog column=; b. putlog "column"; c. putlog _column_; d. putlog _all_;
d
In the data set Invest, what would be the stored value for Year? data invest; do Year=2008 to 2012; Capital+5000; Capital+(Capital*.03); end; run; a. missing b. 2008 c. 2012 d. 2013
d
The purpose of the RETAIN statement is to retain the _________ of a variable between iterations of the DATA step. a. name b. length c. data type d. previous value
d
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
There are 300 observations in the trials data set. How many observations does the test data set contain? data test; set trials(firstobs=150 obs=200); run; a. 200 b. 201 c. 50 d. 51
d
What is the default search order that is used to locate formats? a. LIBRARY.FORMATS -> WORK.FORMATS b. SASHELP.FORMATS -> LIBRARY.FORMATS c. SASHELP.FORMATS -> WORK.FORMATS d. WORK.FORMATS -> LIBRARY.FORMATS
d
What is the difference between sas call routines and regular functions? a. they are interchangable b. call routines are not case sensitive c. functions can only be used with numeric values d. call routines alter column values and cannot be used in assignments
d
What is the final value of Year given the following step? data invest; do Year=2010 to 2019; Capital+5000;Capital+(Capital*.03);end; run; a. . (missing) b. 2010 c. 2019 d. 2020
d
What is the value of X at the completion of the DATA step? data test; x=15; do while(x>12); x+1; end; run; a. 12 b. 15 c. 16 d. This loop executes infinitely.
d
What is the value of x at the completion of the DATA step? data test; x=15; do until(x>12);x+1;end; run; a. . (missing) b. 13 c. 15 d. 16
d
What two hidden columns get automatically created in the PDV? a. _all_ _error_ b. _putlog_ _all_ c. _numeric_ _character_ d. _error_ _n_
d
When will this loop stop? do month = 1 to 12 by 2 until (Savings>5000); savings+Amount; savings+(savings*.02); end; a. when month reaches 12 b. when savings is greater than 5000 c. never d. when month reaches 12 or savings is greater than 5000, whatever comes first
d
Which statement is false about BY-group processing when you use the BY statement with the SET statement? a. The data sets listed in the SET statement must be indexed or sorted by the values of the BY variable(s). b. The DATA step automatically creates two new variables, First. and Last., for each variable in the BY statement. c. The First. and Last. variables identify the first and last observation in each BY group, respectively. d. The First. and Last. variables have values of 0 when SAS is processing an observation with the first occurrence of a new value for those variables, and a value of 1 for the other observations.
d
Which statement is true concerning concatenating tables? a. All tables must have the same number of columns. b. Columns in all tables must have matching names and lengths. c. Tables must be in the same library. d. Missing values are generated for columns that exist in one input table and not in another.
d
Which statement is true concerning concatenating tables? a. All tables must have the same number of columns. b. Columns in all tables must have matching names and lengths. c. Tables must be in the same library. d. Missing values are generated for columns that exist in one input table andnot in another.
d
Which statement is true concerning match-merging? a. The MERGE statement must refer to permanent data sets. b. The variables in the BY statement can be in only one of the data sets. c. Only two data sets can be specified in the MERGE statement. d. When using the MERGE statement with the BY statement, the data must be sorted or indexed on the BY variables.
d
Which statement is true concerning merging with matching rows? a. The MERGE statement must refer to temporary input tables. b. The columns in the BY statement can be in only one of the tables. c. Only two input tables can be specified in the MERGE statement. d. The input tables must be sorted by the columns in the BY statement.
d
Which statement is true concerning merging with matching rows? a. The MERGE statement must refer to temporary input tables. b. The columns in the BY statement can be in only one of the tables. c. Only two input tables can be specified in the MERGE statement. d. The input tables must be sorted by the columns in the BY statement.
d
Which statement is true concerning options for the FORMAT procedure? a. The FMTLIB option goes in the SELECT statement. b. The CNTLIN= option goes in the VALUE statement. c. The FMTLIB option specifies the library to store the format. d. The CNTLIN= option specifies a table from which formats are built.
d
hich statement is true concerning the FMTLIB option in PROC FORMAT? a. The FMTLIB option in PROC FORMAT prints information about all permanent formats in your SAS session. b. The FMTLIB option in PROC FORMAT prints information about all of the formats in the work.formats catalog. c. The FMTLIB option in PROC FORMAT prints information about all of the formats in the LIBRARY.FORMATS option. d. The FMTLIB option in PROC FORMAT prints information about all formats in the catalog that is specified in the LIBRARY= option.
d