Question : The following SAS program is submitted: The program fails execution due to syntax errors. What is the cause of the syntax error? 1. The variable MONTHSALES does not exist. 2. An array cannot be referenced on a KEEP data set option. 3. The KEEP= data set option should be (KEEP = MONTHSALES). 4. The KEEP= data set option should be the statement KEEP MONTHSALES{12}.
Correct Answer : Get Lastest Questions and Answer : Exp: Syntax ARRAY array-name { subscript } ($)(length) array-elements (initial-value-list); Arguments : array-name specifies the name of the array. Restriction: Array-name must be a SAS name that is not the name of a SAS variable in the same DATA step. CAUTION:Using the name of a SAS function as an array name can cause unpredictable results. If you inadvertently use a function name as the name of the array, SAS treats parenthetical references that involve the name as array references, not function references, for the duration of the DATA step. A warning message is written to the SAS log. [cautionend] {subscript} describes the number and arrangement of elements in the array by using an asterisk, a number, or a range of numbers. Subscript has one of these forms: {dimension-size(s)} specifies the number of elements in each dimension of the array. Dimension-size is a numeric representation of either the number of elements in a one-dimensional array or the number of elements in each dimension of a multidimensional array.
Question : 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? 1. Liu only 2. Innis and Ellis only 3. Innis, Ellis, and Liu only 4. Innis, Jolli, Ellis, and Liu
Correct Answer : Get Lastest Questions and Answer : LIKE condition : Tests for a matching pattern. sql-expression (NOT) LIKE sql-expression (ESCAPE character-expression) Arguments : sql-expression : is described in sql-expression. character-expression : is an sql-expression that evaluates to a single character. The operands of character-expression must be character or string literals. Note: If you use an ESCAPE clause, then the pattern-matching specification must be a quoted string or quoted concatenated string; it cannot contain column names. Details : The LIKE condition selects rows by comparing character strings with a pattern-matching specification. It resolves to true and displays the matched strings if the left operand matches the pattern specified by the right operand. The ESCAPE clause is used to search for literal instances of the percent (%) and underscore (_) characters, which are usually used for pattern matching. Patterns for Searching Patterns consist of three classes of characters: underscore (_) : matches any single character. percent sign (%) : matches any sequence of zero or more characters. any other character : matches that character. These patterns can appear before, after, or on both sides of characters that you want to match. The LIKE condition is case-sensitive. The following list uses these values: Smith , Smooth , Smothers , Smart , and Smuggle . 'Sm%' : matches Smith , Smooth , Smothers , Smart , Smuggle . '%th' : matches Smith , Smooth . 'S__gg%' : matches Smuggle . 'S_o' : matches a three-letter word, so it has no matches here. 'S_o%' : matches Smooth , Smothers . 'S%th' : matches Smith , Smooth . 'Z' : matches the single, uppercase character Z only, so it has no matches here. Searching for Literal % and _ : Because the % and _ characters have special meaning in the context of the LIKE condition, you must use the ESCAPE clause to search for these character literals in the input character string. These examples use the values app , a_% , a__ , bbaa1 , and ba_1 . The condition like 'a_%' matches app , a_% , and a__ , because the underscore (_) in the search pattern matches any single character (including the underscore), and the percent (%) in the search pattern matches zero or more characters, including '%' and '_'. The condition like 'a_^%' escape '^' matches only a_% , because the escape character (^) specifies that the pattern search for a literal '%'. The condition like 'a_%' escape '_' matches none of the values, because the escape character (_) specifies that the pattern search for an 'a' followed by a literal '%', which does not apply to any of these values. Searching for Mixed-Case Strings : To search for mixed-case strings, use the UPCASE function to make all the names uppercase before entering the LIKE condition: upcase(name) like 'SM%'; Note: When you are using the % character, be aware of the effect of trailing blanks.
Question : Given the SAS data set ONE: ONE ObsDte ------------- 109JAN2005 212JAN2005 The following SAS program is submitted: data two; set one; day = (insert expression here); format dte date9.; run; The data set TWO is created: TWO ObsDteDay 109JAN20051 12JAN20054 Which expression successfully completed the program and created the variable DAY? 1. day(dte) 2. weekday(dte) 3. dayofweek(dte) 4. datdif(dte,'01jan2005'd,'act/act')
Correct Answer : Get Lastest Questions and Answer : Finding the Day of the Week SAS has various functions that produce calendar dates from SAS date values. SAS date functions enable you to do such things as derive partial date information or use the current date in calculations. If the final payment for a tour is due 30 days before the tour leaves, then the final payment date can be calculated using subtraction; however, Tradewinds Travel is closed on Sundays. If the payment is due on a Sunday, then an additional day must be subtracted to make the payment due on Saturday. The WEEKDAY function, which returns the day of the week as a number from 1 through 7 (Sunday through Saturday) can be used to determine if the return day is a Sunday. The following statements determine the final payment date by subtracting 30 from the departure date , checking the value returned by the WEEKDAY function , subtracting an additional day if necessary , DueDate = DepartureDate - 30; if Weekday(DueDate) = 1 then DueDate = DueDate - 1; Constructing a data set with these statements produces a list of payment due dates. The following program includes these statements and assigns the format WEEKDATE29. to the new variable DueDate: options yearcutoff=1920 pagesize=60 linesize=80 pageno=1 nodate; data pay; set mylib.tourdates; DueDate = DepartureDate - 30; if Weekday(DueDate) = 1 then DueDate = DueDate - 1; format DueDate weekdate29.; run; proc print data=pay; var Country DueDate; title 'Date and Day of Week Payment Is Due'; run;
1. LOCALFEE has format of 9. and COUNTRYFEE has a format of 7. 2. LOCALFEE has format of 9. and COUNTRYFEE has a format of percent6. 3. Access Mostly Uused Products by 50000+ Subscribers 4. The data step fails execution; there is no format for LOCALFEE