Correct Answer : Get Lastest Questions and Answer : Explanation: Keep in mind of dates are given in 4 digit than, it does not matter what you have set for YEARCUTOFF=, they are always interpreted correctly.
Question : Which action assigns a reference named SALES to a permanent SAS data library? 1. Issuing the command: libref SALES 'SAS-data-library' 2. Issuing the command: libname SALES 'SAS-data-library' 3. Access Mostly Uused Products by 50000+ Subscribers libref SALES 'SAS-data-library'; 4. Submitting the statement: libname SALES 'SAS-data-library'; Ans : 4 Exp : The LIBNAME statement assigns a reference known as a libref to a permanent SAS data library. The LIBNAME command opens the LIBNAME window.
Question : The following SAS program is submitted:
data newstaff; set staff; (insert WHERE statement here) run;
Which one of the following WHERE statements completes the program and selects only observations with a Hire_date of February 23,2000?
Ans : 1 Exp : A SAS date constant must take the form of one- or two-digit day, three-digit month, and two- or four-digit year, enclosed in quotation marks and followed by a d ('ddmmmyy(yy)'d).
Ans : 2 Exp : The requested output is in day-month-year order and is 10 bytes long, so DDMMYY10. is the correct format. Although WEEKDATE10. is a valid SAS format, it does not display the SAS date value as shown in the question above. DDMMYYYY10. is not a valid SAS date format, and the DATEw. format cannot accept a length of 10.
Detailed answer: Date refers to this format inside Jan [date format date format only 7,9,11] 30May00 DATE7. 30May2000 DATE9. 30-May-2000 DATE11.
format datein weekdate3.; Mon format datein weekdate6.; Monday format datein weekdate17.; Monday, Apr 5, 99 format datein weekdate21.; Monday, April 5, 1999
Question : Which one of the following displays the contents of an external file from within a SAS session? 1. the LIST procedure 2. the PRINT procedure 3. Access Mostly Uused Products by 50000+ Subscribers 4. the VIEWTABLE procedure Ans : 3 Exp : The PRINT procedure and VIEWTABLE window display the values in SAS data sets. The FSLIST procedure displays the values in external files. There is no LIST procedure in SAS.
Question : The SAS data set Sashelp.Prdsale contains the variables Region and Salary with observations per Region. Sashelp.Prdsale is sorted primarily by Region and with Region by Salary in descending order. The following program is submitted: data one; set sashelp.prdsale; retain temp; by region descending salary; if first.region then do; temp=salary; output; end; if last.region then do; range=salary-temp; output; end; run; For each region, what is the number of observations(s) written to the output data set?
Ans : 3 Exp : The expression first.region is true once for each region group. The expression last.region is true once for each region group. Therefore, each OUTPUT statement executes once for a total of 2 observations in the output data set.
Question : The following program is submitted:
proc contents data=sasuser.houses; run;
The exhibit below contains partial output produced by the CONTENTS procedure
Which of the following describes the Sasuser.Hourses data set? 1. The data set is sorted but not indexed. 2. The data set is both sorted and indexed. 3. Access Mostly Uused Products by 50000+ Subscribers 4. The data set is neither sorted nor indexed.
Explanation: The exhibit above shows partial output from the CONTENTS procedure, In the top right- hand column of the output, you see that Indexes has a value of 0, which indicates that no indexes exist for this data set. Also, Sorted has a value of NO, which indicates that the data is not sorted.
Question The following SAS program is submitted: proc sort data=work.test; by fname descending salary; run; Which one of the following represents how the observations are sorted?
1. The data set Work.Test is sorted in ascending order by both Fname and Salary values. 2. The data set Work.Test is sorted in descending order by both Fname and Salary values. 3. Access Mostly Uused Products by 50000+ Subscribers 4. The data set Work.Test is sorted in ascending order by Fname and descending order by Salary values.
Correct Ans : 4 Exp : The DESCENDING keyword is placed before the variable name it modifies in the BY statement, so the correct description is in descending order by Salary value within ascending Fname values.
Question
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?
Ans : 2 Exp : The length of the variable Division is set to 9 when the DATA step compiles. Since the value of the variable Title is EDU, the first IF condition is true; therefore, the value of the variable Division is Education.
Question Which one of the following SAS programs creates a variable named City with a value of Chicago? 1. data work.airports; AirportCode='ord'; if AirportCode='ORD' City='Chicago'; run;
2. data work.airports; AirportCode='ORD'; if AirportCode='ORD' City='Chicago'; run;
4. data work.airports; AirportCode='ORD'; if AirportCode='ORD'; then City='Chicago'; run;
Ans : 3 Exp : The correct syntax for an IF-THEN statement is: IF expression THEN statement; In this example, the variable City is assigned a value of Chicago only if the expression AirportCode='ORD' is true.
Question : The following SAS program is submitted: data work.building; code='DAL523'; code='SANFRAN604'; code='HOUS731'; run; Which one of the following is the length of the code variable?
1. 6 2. 7 3. Access Mostly Uused Products by 50000+ Subscribers 4. 20 Ans : 1 Exp : The DATA step first goes through a compilation phase, then an execution phase. The length of a variable is set during the compilation phase and is based on the first time the variable is encountered. In this case, the variable code is set to the length of the text string DAL523 which is 6 characters long. The next assignment statements are ignored during compilation. The LENGTH statement is also ignored since the length has already been established, but a note will be written to the log.
Question Which of the following statements creates a numeric variable named IDnumber with a value of 4198? 1. IDnumber=4198; 2. IDnumber='4198'; 3. Access Mostly Uused Products by 50000+ Subscribers 4. length IDnumber $ 8; Ans :1 Exp : The first reference to the SAS variable in the DATA step sets the name, type, and length of the variable in the program data vector (PDV) and in the output SAS data set. The assignment statement IDnumber=4198; is the first reference and creates a numeric variable named IDnumber with a default storage length of 8 bytes.
Question The following SAS 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? 1. Under 6 2. Under 60 3. Access Mostly Uused Products by 50000+ Subscribers 4. " (missing character value) Ans :1 Exp : The variable description is being created by the IF-THEN/ELSE statement during compilation. The first occurrence of the variable description is on the IF statement, and since it is assigned the value Over 60, the length of the variable is 7. Therefore, for the salary value of 30000, description has the value of Under 6 (the 0 is truncated.)
if salary>60000 then description='Over 60';
First appeared when the seven characters, so the length of the description is 7, so after becoming the eight-byte characters, the last one still can not tolerate
Question raw data file is listed below.
1---+----10---+----20---+--- 23 15 The following program is submitted:
data all_sales; infile 'file-specification'; input receipts; (insert statement(s) here) run; Which statement(s) complete(s) the program and produce(s) a running total of the Receipts variable?
1. total+receipts; 2. total 0; sum total; 3. Access Mostly Uused Products by 50000+ Subscribers 4. total=sum(total,receipts); Ans :1 Exp : The SUM function and the assignment statement do not retain values across iterations of the DATA step. The sum statement total+receipts; initializes total to 0, ignores missing values of receipt, retains the value of total from one iteration to the next, and adds the value of receipts to total.
The following SAS program is submitted and references the raw data file above:
data money; infile 'file-specification'; input year quantity; total=total+quantity; run;
What is the value of total when the data step finishes executing
1. 0 2. 1 3. Access Mostly Uused Products by 50000+ Subscribers 4. . (missing numeric value) Ans :4 Exp : The variable Total is assigned a missing value during the compilation phase of the DATA step. When the first record is read in, SAS processes: total=.+2; which results in a missing value. Therefore the variable Total remains missing for all observations.
total=total+quantity;
Because the right-hand side of the total did not define the very beginning, so here is total =. +2 After the state has also been missing
Question The following program is submitted:
data test; average=mean(6,4,.,2);run;
What is the value of average?
1. 0 2. 3 3. Access Mostly Uused Products by 50000+ Subscribers 4. . (missing numeric value) Ans :3 Exp :The MEAN function adds all of the non-missing values and divides by the number of non-missing values. In this case, 6 + 4 + 2 divided by 3 is 4. You can learn about the MEAN function in Transforming Data with SAS Functions.
All non-missing divided by the sum of the number of non-missing (equivalent to completely ignore missing)
Question 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?
1. ( 3) 2. (312) 3. Access Mostly Uused Products by 50000+ Subscribers 4. 312 Ans :1 Exp : An automatic data conversion is performed whenever a numeric variable is used where SAS expects a character value. The numeric variable is written with the BEST12. format and the resulting character value is right-aligned when the conversion occurs. In this example, the value of Phonenumber is converted to character and right-aligned before the SUBSTR function is performed. Since there are only 10 digits in the value of Phonenumber, the right-aligned value begins with two blanks. Therefore the SUBSTR function picks up two blanks and a 3, and uses the BEST12. format to assign that value to Code. Then, the parentheses are concatenated before and after the two blanks and a 3.
In short, the numbers are right sort of - Specifically, SAS writes the numeric value with the BEST12. format, and the resulting character value is right-aligned. This conversion occurs before the value is assigned or used with any operator or function. Automatic numeric-to-character conversion can cause unexpected results. For example, suppose the original numeric value has fewer than 12 digits. The resulting character value will have leading blanks, which might cause problems when you perform an operation or function. - format refers to the instructions that SAS uses when printing variable values. If no format is specified, the default format is BEST12. for a numeric variable, and $w. for a character variable. You can assign SAS formats to a variable in the FORMAT or ATTRIB statement. You can use the FORMAT procedure to create your own format for a variable.
Question The following SAS program is submitted:
data work.inventory; products=7; do until (products gt 6); products+1; end; run;
Which one of the following is the value of the variable products in the output data set?
1. 5 2. 6 3. Access Mostly Uused Products by 50000+ Subscribers 4. 8 Ans :4 Exp : A DO UNTIL loop always executes at least once because the condition is not evaluated until the bottom of the loop. In the SAS program above, the value of Products is incremented from 7 to 8 on the first iteration of the DO UNTIL loop, before the condition is checked. Therefore the value of Products is 8.
Question : The following program is submitted: data work.test; set work.staff (keep=salary1 salary2 salary3); (insert ARRAY statement here) run; Which ARRAY statement completes the program and creates new variables?
Explanation: Although each of the ARRAY statements listed above is a valid statement, only Answer B creates new variables named new_salary1, new_salary2 and new_salary3. Answer C and Answer D both create an array that groups the existing data set variables salary1, salary2, and salary3. Since the array in Answer A is named salary, it also uses the existing data set variables
Each pair, but only B is to produce a new variable, new_salary1, new_salary2 and new_salary3. . The other three are the integration of the existing three variables a bit, and no new
1. This will be a character string with the value '04/01/2000' 2. This will be a character string with the value 'Monday, April 01, 2000' 3. Access Mostly Uused Products by 50000+ Subscribers 4. This will be a numeric value 04252000, representing the SAS date for April 01, 2000
1. No library references are required 2. The data sets listed on all the IF statements require a library reference 3. Access Mostly Uused Products by 50000+ Subscribers 4. The data sets listed in the first two IF statements require a library reference.