A typical value for the character variable Target is 123,456. Which statement correctly converts the values of Target to numeric values when creating the variable TargetNo? a. TargetNo=input(target,comma6.); b. TargetNo=input(target,comma7.); c. TargetNo=put(target,comma6.); d. TargetNo=put(target,comma7.); | |||||||||||||
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||'/'||input(sitenum,3.1); b. Location=dept||'/'||input(sitenum,4.1); c. Location=dept||'/'||put(sitenum,3.1); d. Location=dept||'/'||put(sitenum,4.1); | |||||||||||||
Suppose the YEARCUTOFF= system option is set to 1920. Which MDY function creates the date value for January 3, 2020? a. MDY(1,3,20) b. MDY(3,1,20) c. MDY(1,3,2020) d. MDY(3,1,2020) | |||||||||||||
The variable Address2 contains values such as a. State=scan(address2,2); b. State=scan(address2,13,2); c. State=substr(address2,2); d. State=substr(address2,13,2); | |||||||||||||
The variable IDCode contains values such as 123FA and 321MB. The fourth character identifies sex. How do you assign these character codes to a new variable named Sex? a. Sex=scan(idcode,4); b. Sex=scan(idcode,4,1); c. Sex=substr(idcode,4); d. Sex=substr(idcode,4,1); | |||||||||||||
Due to growth within the 919 area code, the telephone exchange 555 is being reassigned to the 920 area code. The data set Clients.Piedmont includes the variable Phone, which contains telephone numbers in the form 919-555-1234. Which of the following programs will correctly change the values of Phone? a. data work.piedmont(drop=areacode exchange); set clients.piedmont; Areacode=substr(phone,1,3); Exchange=substr(phone,5,3); if areacode='919' and exchange='555' then scan(phone,1,3)='920'; run; b. data work.piedmont(drop=areacode exchange); set clients.piedmont; Areacode=substr(phone,1,3); Exchange=substr(phone,5,3); if areacode='919' and exchange='555' then phone=scan('920',1,3); run; c. data work.piedmont(drop=areacode exchange); set clients.piedmont; Areacode=substr(phone,1,3); Exchange=substr(phone,5,3); if areacode='919' and exchange='555' then substr(phone,1,3)='920'; run; d. data work.piedmont(drop=areacode exchange); set clients.piedmont; Areacode=substr(phone,1,3); Exchange=substr(phone,5,3); if areacode='919' and exchange='555' then phone=substr('920',1,3); run; | |||||||||||||
Suppose you need to create the variable FullName by concatenating the values of FirstName, which contains first names, and LastName, which contains last names. What's the best way to remove extra blanks between first names and last names? a. data work.maillist; set retail.maillist; length FullName $ 40; fullname=trim firstname||' '||lastname; run; b. data work.maillist; set retail.maillist; length FullName $ 40; fullname=trim(firstname)||' '||lastname; run; c. data work.maillist; set retail.maillist; length FullName $ 40; fullname=trim(firstname)||' '||trim(lastname);run; d. data work.maillist; set retail.maillist; length FullName $ 40; fullname=trim(firstname||' '||lastname); run; | |||||||||||||
Within the data set Furnitur.Bookcase, the variable Finish contains values such as ash/cherry/teak/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 furnitur.bookcase; if index(finish,walnut) = 0; run; b. data work.bookcase; set furnitur.bookcase; if index(finish,'walnut') > 0; run; c. data work.bookcase; set furnitur.bookcase; if index(lowcase(finish),walnut) = 0; run; d. data work.bookcase; set furnitur.bookcase; if index(lowcase(finish),'walnut') > 0;run; | |||||||||||||
Which statement is false regarding the use of DO loops? a. They can contain conditional clauses. b. They can generate multiple observations. c. They can be used to combine DATA and PROC steps. d. They can be used to read data. | |||||||||||||
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 | |||||||||||||
On January 1 of each year, $5,000 is invested in an account. Complete the DATA step below to determine the value of the account after 15 years if a constant interest rate of 10% is expected. data work.invest; ... Capital+5000; capital+(capital*.10); end; run; a. do count=1 to 15; b. do count=1 to 15 by 10%; c. do count=1 to capital; d. do count=capital to (capital*.10); | |||||||||||||
In the data set Work.Invest, what would be the stored value for Year? data work.invest; do year=1990 to 2004; Capital+5000; capital+(capital*.10); end; run; a. missing b. 1990 c. 2004 d. 2005 | |||||||||||||
Which of the following statements is false regarding the program shown below? data work.invest; do year=1990 to 2004; Capital+5000; capital+(capital*.10); output; end; run; a. The OUTPUT statement writes current values to the data set immediately. b. The stored value for Year is 2005. c. The OUTPUT statement overrides the automatic output at the end of the DATA step. d. The DO loop performs 15 iterations. | |||||||||||||
How many observations will the data set Work.Earn contain? data work.earn; Value=2000; do year=1 to 20; Interest=value*.075; value+interest; output; end; run; a. 0 b. 1 c. 19 d. 20 | |||||||||||||
Which of the following would you use to compare the result of investing $4,000 a year for five years in three different banks that compound interest monthly? Assume a fixed rate for the five-year period. a. DO WHILE statement b. nested DO loops c. DO UNTIL statement d. a DO group | |||||||||||||
Which statement is false regarding DO UNTIL statements? a. The condition is evaluated at the top of the loop, before the enclosed statements are executed. b. The enclosed statements are always executed at least once. c. SAS statements in the DO loop are executed until the specified condition is true. d. The DO loop must have a closing END statement. | |||||||||||||
Select the DO WHILE statement that would generate the same result as the program below. data work.invest; capital=100000; do until(Capital gt 500000); Year+1; capital+(capital*.10); end; run; a. do while(Capital ge 500000); b. do while(Capital=500000); c. do while(Capital le 500000); d. do while(Capital<500000); | |||||||||||||
In the following program, complete the statement so that the program stops generating observations when Distance reaches 250 miles or when 10 gallons of fuel have been used. data work.go250; set perm.cars; do gallons=1 to 10 ... ; Distance=gallons*mpg; output; end; run; a. while(Distance<250) b. when(Distance>250) c. over(Distance le 250) d. until(Distance=250) | |||||||||||||
379. | Which statement is false regarding an ARRAY statement? a. It is an executable statement. b. It can be used to create variables. c. It must contain either all numeric or all character elements. d. It must be used to define an array before the array name can be referenced. | ||||||||||||
380. | What belongs within the braces of this ARRAY statement? array contrib{?} qtr1-qtr4; a. quarter b. quarter* c. 1-4 d. 4 | ||||||||||||
For the program below, select an iterative DO statement to process all elements in the contrib array. data work.contrib; array contrib{4} qtr1-qtr4; ... contrib{i}=contrib{i}*1.25; end; run; a. do i=4; b. do i=1 to 4; c. do until i=4; d. do while i le 4; | |||||||||||||
What is the value of the index variable that references Jul in the statements below? array quarter{4} Jan Apr Jul Oct; do i=1 to 4; yeargoal=quarter{i}*1.2; end; a. 1 b. 2 c. 3 d. 4 | |||||||||||||
Which DO statement would not process all the elements in the factors array shown below? array factors{*} age height weight bloodpr; a. do i=1 to dim(factors); b. do i=1 to dim(*); c. do i=1,2,3,4; d. do i=1 to 4; | |||||||||||||
Which statement below is false regarding the use of arrays to create variables? a. The variables are added to the program data vector during the compilation of the DATA step. b. You do not need to specify the array elements in the ARRAY statement. c. By default, all character variables are assigned a length of eight. d. Only character variables can be created. | |||||||||||||
For the first observation, what is the value of diff{i} at the end of the second iteration of the DO loop?
array wt{*} weight1-weight10; array diff{9}; do i=1 to 9; diff{i}=wt{i+1}-wt{i}; end; a. 15 b. 10 c. 8 d. -7 | |||||||||||||
Finish the ARRAY statement below to create temporary array elements that have initial values of 9000, 9300, 9600, and 9900. array goal{4} ... ; a. _temporary_ (9000 9300 9600 9900) b. temporary (9000 9300 9600 9900) c. _temporary_ 9000 9300 9600 9900 d. (temporary) 9000 9300 9600 9900 | |||||||||||||
Based on the ARRAY statement below, select the array reference for the array element q50. array ques{3,25} q1-q75; a. ques{q50} b. ques{1,50} c. ques{2,25} d. ques{3,0} | |||||||||||||
Select the ARRAY statement that defines the array in the following program. data rainwear.coat; input category high1-high3 / low1-low3; ... do i=1 to 2; do j=1 to 3; compare{i,j}=round(compare{i,j}*1.12); end; end; run; a. array compare{1,6} high1-high3 low1-low3; b. array compare{2,3} high1-high3 low1-low3; c. array compare{3,2} high1-high3 low1-low3; d. array compare{3,3} high1-high3 low1-low3; | |||||||||||||
Which SAS statement correctly uses column input to read the values in the raw data file below in this order: Address (4th field), SquareFeet (second field), Style (first field), Bedrooms (third field)? ![]() a. input Address 15-29 SquareFeet 8-11 Style 1-6 b. Bedrooms 13; c. input $ 15-29 Address 8-11 SquareFeet $ 1-6 Style d. 13 Bedrooms; e. input Address $ 15-29 SquareFeet 8-11 Style $ 1-6 f. Bedrooms 13; g. input Address 15-29 $ SquareFeet 8-11 Style 1-6 h. $ Bedrooms 13; | |||||||||||||
Which is not an advantage of column input? a. It can be used to read character variables that contain embedded blanks. b. No placeholder is required for missing data. c. Standard as well as nonstandard data values can be read. d. Fields do not have to be separated by blanks or other delimiters. | |||||||||||||
Which is an example of standard numeric data? a. -34.245 b. $24,234.25 c. 1/2 d. 50% | |||||||||||||
Formatted input can be used to read a. standard free-format data b. standard data in fixed fields c. nonstandard data in fixed fields d. both standard and nonstandard data in fixed fields | |||||||||||||
Which informat should you use to read the values in column 1-5? ![]() a. w. b. $w. c. w.d d. COMMAw.d | |||||||||||||
The COMMAw.d informat can be used to read which of the following values? a. 12,805 b. $177.95 c. 18 % d. all of the above | |||||||||||||
Which INPUT statement correctly reads the values for ModelNumber (first field) after the values for Item (second field)? Both Item and ModelNumber are character variables. ![]() a. input +7 Item $9. @1 ModelNumber $5.; b. input +6 Item $9. @1 ModelNumber $5.; c. input @7 Item $9. +1 ModelNumber $5.; d. input @7 Item $9 @1 ModelNumber 5.; | |||||||||||||
Which INPUT statement correctly reads the numeric values for Cost (third field)? ![]() a. input @17 Cost 7.2; b. input @17 Cost 9.2.; c. input @17 Cost comma7.; d. input @17 Cost comma9.; | |||||||||||||
Which SAS statement correctly uses formatted input to read the values in this order: Item (first field), UnitCost (second field), Quantity (third field)? ![]() a. input @1 Item $9. +1 UnitCost comma6. b. @18 Quantity 3.; c. input Item $9. @11 UnitCost comma6. d. @18 Quantity 3.; e. input Item $9. +1 UnitCost comma6. f. @18 Quantity 3.; g. all of the above | |||||||||||||
Which raw data file requires the PAD option in the INFILE statement in order to correctly read the data using either column input or formatted input? a. ![]() b. ![]() c. ![]() d. ![]() | |||||||||||||
The raw data file referenced by the fileref Students contains data that is ![]() a. arranged in fixed fields b. free format c. mixed format d. arranged in columns | |||||||||||||
Which input style should be used to read the values in the raw data file that is referenced by the fileref Students? ![]() a. column b. formatted c. list d. mixed |

SAS Help, SAS Activity, sas installation, sas certification, sas base preparation, sas interview, sas prep guide, sas tutorial, SAS/BASE, SAS/MACROS,SAS/SQL, PROC SQL, Macros, SAS/STAT, SAS/BI, SAS/DI, sas, Enterprise Guide, Enterprise Miner, Information Delivery Portal, SAS/ACCESS, SAS/GRAPH, SAS/Warehouse Administrator, SAS GUIDE ★★★★★ #1
Friday, March 2, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.