Premium

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



Question : You have been given a data sets in row and column format as below, please find number of observations and variables in it?

EmployeeName,salary,dateofBirth
Rahul,100K,08071978
Vineet,NA,08091970
Venkat,200K,09091973
Sonal,150K,09081988


 : You have been given a data sets in row and column format as below, please find number of observations and variables in it?
1. 3 observations, 4 variables
2. 3 observations, 3 variables
3. Access Mostly Uused Products by 50000+ Subscribers
. Question does not have entire information.


Correct Answer : Get Lastest Questions and Answer :

Explanation: As there are in total 4 rows (So we have observed 4 employee information and for each employee 3 attributes are given, which we can say this are variable.





Question :

A raw data record is listed below:
--------10-------20-------30
1999/10/25
The following SAS program is submitted:
data projectduration;
infile 'file-specification';
input date $ 1 - 10;

run;
Which one of the following statements completes the program above and computes the duration of the project in days as of today's
date?


 :
1. duration = today( ) - put(date,ddmmyy10.);
2. duration = today( ) - put(date,yymmdd10.);
3. Access Mostly Uused Products by 50000+ Subscribers
4. duration = today( ) - input(date,yymmdd10.);


Correct Answer : Get Lastest Questions and Answer :

Explanation: : It cannot be a PUT function because it converts Numeric to Char values. For calculations we need Num variable => So INPUT function, also year is the first mentioned value so
answer is D.

Input function converts character to numeric, put funtion converts numeric to char ...so here date is given as character,,input function and date is in the form of yymmdd10.





Question :

The following SAS program is submitted:
data work.month;
date = put('13mar2000'd,ddmmyy10.);
run;
Which one of the following represents the type and length of the variable DATE in the output data set?

 :
1. numeric, 8 bytes
2. numeric, 10 bytes
3. Access Mostly Uused Products by 50000+ Subscribers
4. character, 10 bytes

Correct Answer : Get Lastest Questions and Answer :
put function converts num to char thus date be displayed as 03/13/2000, taking up 10 bytes. ddmmyy10. formats date to be 10 bytes in length i.e dd/mm/yyyy, and 'put' converts value
into a character type

use
proc contents data=month;
run;
you will get to know how the answer is D.



Related Questions


Question :
Given the following code:
proc print data=SASHELP.CLASS(firstobs=5 obs=15);
where Sex='M';
run;
How many observations will be displayed?

  :
1. 11
2. 15
3. Access Mostly Uused Products by 50000+ Subscribers
4. 11 or fewer


Question :
The SAS data set named WORK.SALARY contains 10 observations for each department, and is currently
ordered by Department. The SAS program is submitted (left image):

Which statement is true?

  :
1. The by statement in the DATA step causes a syntax error.
2. The statement Payroll+(MonthlyWageRate*12); in the data step causes a syntax error.
3. Access Mostly Uused Products by 50000+ Subscribers
4. The values of the variable Payroll represent a monthly total for all values of WAGERATE in the WORK.SALARY data set.


Question :
Given the contents of the raw data file TYPECOLOR.DAT: (left image)

What are the values of the variables Type and Color?

  :
1. Type=daisy, Color=yellow
2. Type=daisy, Color=w
3. Access Mostly Uused Products by 50000+ Subscribers
4. Type=daisy, Color=


Question :
The following SAS program is submitted: (left image)

What new variables are created?

  :
1. Difcount1, Difcount2 and Difcount3
2. Diff1, Diff2 and Diff3
3. Access Mostly Uused Products by 50000+ Subscribers
4. Patients1, Patients2 and Patients3


Question :
Given the raw data record in the file phone.txt:
Which SAS statement completes the program and results in a value of "James Stevens" for the
variableFullName?

  :
1. FullName=CATX(' ',EmpFName,EmpLName);
2. FullName=CAT(' ',EmpFName,EmpLName);
3. Access Mostly Uused Products by 50000+ Subscribers
4. FullName=EmpFName + EmpLName;


Question :

A realtor has two customers. One customer wants to view a list of homes selling for less than $60,000. The other customer wants
to view a list of homes selling for greater than $100,000.
Assuming the PRICE variable is numeric, which one of the following PRINT procedure steps will select all desired observations?

 :
1. proc print data = sasuser.houses;
where price lt 60000;
where price gt 100000;
run;
2. proc print data = sasuser.houses;
where price lt 60000 or price gt 100000;
run;
3. Access Mostly Uused Products by 50000+ Subscribers
where price lt 60000 and price gt 100000;
run;
4. proc print data = sasuser.houses;
where price lt 60000 or where price gt 100000;
run;
Ans : 2
Exp : 'OR' gives either of one condition whereas we need both condition results , so answer is B. 'OR' means either one of d conditions shd b true. In this case both the
conditions are true, so it will give desired observations. Here if we use 'AND' it will search for the observations in which both the conditions are true at d same time. ie. the
obs where the price is ln 60000 and also the preice is gt100000. Hence answer is not correct.

'OR' means either one of d conditions shd b true. In this case both the conditions are true, so it will give desired observations. Here if we use 'AND' it will search for the
observations in which both the conditions are true at d same time. ie. the obs where the price is ln 60000 and also the preice is gt100000. Hence answer is not correct.




Question : The value is stored in a numeric variable.
Which one of the following SAS formats is used to display the value as $110,700.00 in a report?
 :
1. comma8.2
2. comma11.2
3. Access Mostly Uused Products by 50000+ Subscribers
4. dollar11.2
Ans : 4

Exp : the total width is 11 not 8, so it comes down to either of dollar11.2 or comma11.2. But comma11.2 does not insert dollar sign along with comma. So the answer is 4.

when you use comma11.2 as an informat, sas removes dollar signs, commas and percent signs(if they exist in the value you are trying to read) whereas the format dollar11.2 inserts a
dollar sign and a comma.




Question :
The SAS data set BANKS is listed below:
BANKS
name rate
FirstCapital 0.0718
DirectBank 0.0721
VirtualDirect 0.0728
The following SAS program is submitted:
data newbank;
do year = 1 to 3;
set banks;
capital + 5000;
end;
run;
Which one of the following represents how many observations and variables will exist in the SAS data set NEWBANK?


 :
1. 0 observations and 0 variables
2. 1 observations and 4 variables
3. Access Mostly Uused Products by 50000+ Subscribers
4. 9 observations and 2 variables

Ans : 2
Exp :

The four variables are Name, Rate, Year, Capital. we have three variables in the dataset, when we set the dataset in the do loop it reads the three observations from data set
banks (as the set statement is called thrice) when they do loop terminates the value for year is 4 and the implicit output is executed at run;

this causes the observation to be written in the new data set. since all three observations are read in the the do loop the data step gets terminated and only one observations is
written since we have two additional variables in the data step year and capital we get total of 4 variables




Question :

The following SAS program is submitted:
data work.clients;
calls = 6;
do while (calls le 6);
calls + 1;
end;
run;
Which one of the following is the value of the variable CALLS in the output data set?



 :
1. 4
2. 5
3. Access Mostly Uused Products by 50000+ Subscribers
4. 7
Ans : 4
Exp : Please note the difference between do while and do until:


DO WHILE
The while test is evaluated at the top of the loop.

DO UNTIL
The until test is evaluated at the bottom of the loop.

DO WHILE (evaluates at the top of the loop) Now, calls=6 is equal to 6 therefore calls le 6 is TRUE. DO LOOP is executed. So, calls = calls +1 = 7

Now, calls=7 is greater than 6 therefore calls le 6 is FALSE. DO LOOP is not executed.

Hence, the value of calls remains 7

here, note that the operator is LE (less than or equal to). So the condition is true the first time.
Calls = 6 and it becomes Calls + 1 => 6+1 = 7.

The loop stops executing as the value of calls becomes greater than 6. Thus, output is 7.




Question :

The following SAS program is submitted:
data work.pieces;
do while (n lt 6);
n + 1;
end;
run;
Which one of the following is the value of the variable N in the output data set?



 :
1. 4
2. 5
3. Access Mostly Uused Products by 50000+ Subscribers
4. 7
Ans : 3
Exp : DO WHILE
The while test is evaluated at the top of the loop.

DO UNTIL
The until test is evaluated at the bottom of the loop.


DO WHILE (evaluates at the top of the loop). [Remember: SAS gives value starting from 0, if value not defined] n=0, 1, 2, 3, 4, 5 than n is lt (less than) 6 therefore n lt 6 is TRUE.
DO LOOP is executed.
Adding plus 1 at every iteration.
Now, when n=6 at top, it is not less than 6 therefore condition n lt 6 is FALSE. DO LOOP is not executed.
Hence, the value of n remains 6

because of n+1 statement we assume a implicit retain n 0; statment.
First loop (0 lt 6) => true => n = 1
Second loop (1 lt 6) => true => n= 2
......
last loop (6 lt 6) => false => do while exits and pdv writes 6 as value of n in output dataset.




Question :

Suppose the YEARCUTOFF= system option is set to 1920. An input file contains the date expression 12/08/1925,
which is being read with the MMDDYY8. informat. Which date will appear in your data?


 :
1. 08DEC1920
2. 08DEC1925
3. Access Mostly Uused Products by 50000+ Subscribers
4. 08DEC2025
Ans : 3
Exp : The w value of the informat MMDDYY8. is too small to read the entire value, so the last two digits of the year are truncated. The last two digits thus become 19 instead of 25.
Because the YEARCUTOFF= system option is set to 1920, SAS interprets this year as 2019. To avoid such errors, be sure to specify an informat that is wide enough for your date
expressions



Question :

Suppose your program creates two variables from an input file. Both variables are stored as
SAS date values: FirstDay records the start of a billing cycle, and LastDay records the end of that cycle.
The code for calculating the total number of days in the cycle would be:


 :
1. TotDays=lastday-firstday;
2. TotDays=lastday-firstday+1;
3. Access Mostly Uused Products by 50000+ Subscribers
4. You cannot use date values in calculations.
Ans : 2
Exp : To find the number of days spanned by two dates, subtract the first day from the last day and add one. Because SAS date values are numeric values, they can easily be used in
calculations





Question :

You can position the input pointer on a specific record by using


 :
1. column pointer controls
2. column specifications.
3. Access Mostly Uused Products by 50000+ Subscribers
4. line hold specifiers.

Ans : 3
Exp : Information for one observation can be spread out over several records. You can write one INPUT statement that contains line pointer controls to specify the record(s) from
which values are read.



Question : When you are creating a custom format using FORMAT procedure, than which of the following statement is correct?

 :
1. Format name and Data set name should be same.

2. Format name should be longer the 2 character

3. Access Mostly Uused Products by 50000+ Subscribers

4. Format name should start with the $ sign only in case, it is applied to the character variable

5. Format name should start with the $ sign only in case, it is applied to the character variable