Premium

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



Question :The SAS data set WORK.ONE contains a numeric variable named Num ana character variable named
Char:
WORK.ONE
Num Char
------ ------
1 23
3 23
1 77
The following SAS program is submitted:
proc print data=WORK.ONE;
where Num='1';
run;
What is output?
  :The SAS data set WORK.ONE contains a numeric variable named Num ana character variable named
1. Num Char
--- ----
1 23
2. Num Char
--- ----
1 23
1 77
3. Access Mostly Uused Products by 50000+ Subscribers
Num Char
----
1 23
3 23
1 77
4. No output is generated

Correct Answer : Get Lastest Questions and Answer :

Explanation:




Question :The following output is created by the FREQUENCY procedure:
Which TABLES statement was used to completed the following program that produced the output?
proc freq data=sales;
(_insert_code_)
run;
  :The following output is created by the FREQUENCY procedure:
1. tables region product;
2. tables region,product
3. Access Mostly Uused Products by 50000+ Subscribers
4. tables region*product;


Correct Answer : Get Lastest Questions and Answer :

Explanation:





Question :Given the following data step:
After data step execution, what will data set WORK.GEO contain?

  :Given the following data step:
1. a
2. b
3. Access Mostly Uused Products by 50000+ Subscribers
4. d


Correct Answer : Get Lastest Questions and Answer :

Explanation:




Related Questions


Question : You have set YEARCUTOFF= (which is default as well). Now you have date as -May-. How this date will be read by SAS?

 : You have set YEARCUTOFF= (which is default as well). Now you have date as -May-. How this date will be read by SAS?
1. 01-May-2025

2. 01-May-1925

3. Access Mostly Uused Products by 50000+ Subscribers

4. 01-May-2026

5. 01-May-1926



Question : Which action assigns a reference named SALES to a permanent SAS data library?
  : 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?


  : Which action assigns a reference named SALES to a permanent SAS data library?
1. where hire_date='23feb2000'd;
2. where hire_date='23feb2000';
3. Access Mostly Uused Products by 50000+ Subscribers
4. where hire_date='02/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).



Question : Which one of the following SAS date formats displays the SAS date value for January , in the form of //?
  : Which action assigns a reference named SALES to a permanent SAS data library?
1. DATE10
2. DDMMYY10
3. Access Mostly Uused Products by 50000+ Subscribers
4. DDMMYYYY10


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.

101599 MMDDYY6.
10/15/99 MMDDYY8.
10 15 99 MMDDYY8.
10-15-1999 MMDDYY10.

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?
  : Which action assigns a reference named SALES to a permanent SAS data library?
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?

  : Which action assigns a reference named SALES to a permanent SAS data library?
1. 0
2. 1
3. Access Mostly Uused Products by 50000+ Subscribers
4. 4

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?
  : Which action assigns a reference named SALES to a permanent SAS data library?
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.



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?

  The following SAS program is submitted:
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?


  The following SAS program is submitted:
1. Educatio
2. Education
3. Access Mostly Uused Products by 50000+ Subscribers
4. Human Resources

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?
  The following SAS program is submitted:
1. data work.airports;
AirportCode='ord';
if AirportCode='ORD' City='Chicago';
run;

2. data work.airports;
AirportCode='ORD';
if AirportCode='ORD' City='Chicago';
run;

3. Access Mostly Uused Products by 50000+ Subscribers
AirportCode='ORD';
if AirportCode='ORD' then 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?


  The following SAS program is submitted:
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?
  The following SAS program is submitted:
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?
  The following SAS program is submitted:
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?

  The following SAS program is submitted:
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.


Question A raw data file is listed below.

1---+----10---+----20---+---
1901 2
1905 1
1910 6
1925 1
1941 1

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

  The following SAS program is submitted:
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?

  The following SAS program is submitted:
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?

  The following SAS program is submitted:
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?

  The following SAS program is submitted:
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?

  The following SAS program is submitted:
1. array salary{3};
2. array new_salary{3};
3. Access Mostly Uused Products by 50000+ Subscribers
4. array new_salary{3} salary1-salary3;
Ans :2


Question Which of the following permanently associates a format with a variable?
  Which of the following permanently associates a format with a variable?
1. the FORMAT procedure
2. a FORMAT statement in a DATA step
3. Access Mostly Uused Products by 50000+ Subscribers
4. an INPUT statement with formatted style input
Ans :2
Exp : To permanently associate a format with a variable, you use the FORMAT statement in a DATA step. You can use the FORMAT procedure to create a user-defined format. You use the
INPUT function to convert character data values to numeric values with an informat. You use the INPUT statement to read data into a data set with an informat.


Question The following report is generated:

Style
of homes n Asking
Price
----------------------------
CONDO 4 $99,313
RANCH 4 $68,575
SPLIT 3 $77,983
TWOSTORY 4 $83,825
Which of the following steps created the report?

  Which of the following permanently associates a format with a variable?
1. proc freq data=sasuser.houses;
tables style price /nocum;
format price dollar10.;
label style="Style of homes"
price="Asking price"; run;
2. proc print data=sasuser.houses;
class style;
var price;
table style,n price*mean*f=dollar10.;
label style="Style of homes" price="Asking price"; run;
3. Access Mostly Uused Products by 50000+ Subscribers
class style;
var price;
format price dollar10.;
label style="Style of homes" price="Asking price"; run;

4. proc report data=sasuser.houses nowd headline;
column style n price;
define style / group "Style of homes";
define price / mean format=dollar8. "Asking price"; run;

Ans :4
Exp : The FREQ procedure cannot create the average asking price. The CLASS statement and the VAR statement are not valid for use with the PRINT procedure. The MEANS procedure output
would have both the N statistic and the N Obs statistic since a CLASS statement is used. The REPORT procedure produced the report.


Question A SAS report currently flows over two pages because it is too long to fit within the
specified display dimension. Which one of the following actions would change the display dimension so that the report fits on one page?
  Which of the following permanently associates a format with a variable?
1. Increase the value of the LINENO option.
2. Decrease the value of the PAGENO option.
3. Access Mostly Uused Products by 50000+ Subscribers
4. Increase the value of the PAGESIZE option.
Ans :4
Exp : The PAGESIZE= SAS system option controls the number of lines that compose a page of SAS procedure output. By increasing the number of lines available per page, the report might
fit on one page.

Question :

Which one of the following SAS REPORT procedure options controls how column headings are displayed over multiple lines?


  Which of the following permanently associates a format with a variable?
1. SPACE=
2. SPLIT=
3. Access Mostly Uused Products by 50000+ Subscribers
4. BREAK=



Question :

The following SAS program is submitted:

ods html file='newfile.html';proc print data=sasuser.houses;run;proc means data=sasuser.houses;run;proc freq data=sasuser.shoes;run;ods html close;proc print data=sasuser.shoes;run;

How many HTML files are created?



 :
1. 1
2. 2
3. Access Mostly Uused Products by 50000+ Subscribers
4. 4


Question :

A frequency report of the variable Jobcode in the Work.Actors data set is listed below.

The following SAS program is submitted:

data work.joblevels;
set work.actors;
if jobcode in ('Actor I', 'Actor II')
then
joblevel='Beginner';
ifjobcode='Actor III'
then joblevel='Advanced';
else joblevel='Unknown';
run;

Which of the following represents the possible values for the variable joblevel in the Work.Joblevels data set?


 :
1. Advanced and Unknown only
2. Beginner and Advanced only
3. Access Mostly Uused Products by 50000+ Subscribers
4. " (missing character value)