Premium

Base SAS Certified Associate: Programming Fundamentals Using SAS Questions and Answers (Dumps and Practice Questions)



Question : The following SAS program is submitted:
The program fails execution due to syntax errors. What is the cause of the syntax error?
 : The following SAS program is submitted:
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?
 : Given the SAS data set EMPLOYEES:
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?
 : Given the SAS data set ONE:
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;



Related Questions


Question : When you run the below program what will happen (SAS windows environment)
data work.prices;
infile '/folders/myfolders/hadoopexam/hesample1.dat';
input CODE $ NAME$ FEE1 FEE2;
if NAME='SPARK;
run;

proc print data= work.prices ;
run;

 : When you run the below program what will happen (SAS windows environment)
1. Program will run successfully

2. An error message will be printed

3. Access Mostly Uused Products by 50000+ Subscribers
become too long or that the statement is ambiguous.

4. None of the above



Question : You are reviewing the SAS code written by a one of the junior programmer in your team. However, there seems to be a syntax error. What
happens when you run a program with a Syntax error?

 : You are reviewing the SAS code written by a one of the junior programmer in your team. However, there seems to be a syntax error. What
1. Syntax error will be auto corrected by the SAS and program will gracefully completed

2. Log window will tell you the syntax error, however program will finishes successfully

3. Access Mostly Uused Products by 50000+ Subscribers

4. In a step where syntax error, SAS will not run that particular step and you can see the error in output window.

5. In a step where syntax error, SAS will not run tell you where the error is.



Question : One of your junior programmer is running SAS program and he is complaining that there is a syntax error in the SAS code, what do you
interpret?

 : One of your junior programmer is running SAS program and he is complaining that there is a syntax error in the SAS code, what do you
1. Given data is not in expected format

2. SAS statement is not having valid keyword

3. Access Mostly Uused Products by 50000+ Subscribers

4. Any of the above



Question : You have submitted a SAS program, but there seems to be an invalid option given in a statement, How would you identify that?

 : You have submitted a SAS program, but there seems to be an invalid option given in a statement, How would you identify that?
1. Wherever is an invalid option given SAS will give Error message for that

2. In the log message you can see that an option is not a valid or not recognized

3. Access Mostly Uused Products by 50000+ Subscribers

4. You have to carefully examine the SAS program, because SAS will not tell you about invalid option and will be ignored by the SAS.



Question : The following SAS program is submitted:
data temp.x;
set sasuser.y;
run;
What must be submitted prior to this SAS program for the program to execute successfully?
  : The following SAS program is submitted:
1. A LIBNAME statement for the libref TEMP only must be submitted.
2. A LIBNAME statement for the libref SASUSER only must be submitted.
3. Access Mostly Uused Products by 50000+ Subscribers
4. No LIBNAME statement needs to be submitted.




Question : The data set RALESTATE has the variable LOCALFEE with a format or . and a variable

COUNTRYFEE with a format or 7.;

The following SAS program is submitted:
data history;
format local fee country fee percent6.;
set realestate;
local fee = local fee / 100;
country fee = country fee / 100;
run;

What are the formats of the variables LOCALFEE and COUNTRYFEE in the output dataset?

  :  The data set RALESTATE has the variable LOCALFEE with a format or . and a variable
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