• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/68

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

68 Cards in this Set

  • Front
  • Back
The following SAS program is submitted:
data work.total;
set work.salary(keep = department wagerate);
by department;
if first.department then payroll = 0;
payroll + wagerate;
if last.department;
run;

The SAS data set named WORK.SALARY contains 10 observations for each department, currently ordered by DEPARTMENT.

Which one of the following is true regarding the program above?

A. The BY statement in the DATA step causes a syntax error.
B. FIRST.DEPARTMENT and LAST.DEPARTMENT are variables in the WORK.TOTAL data set.
C. The values of the variable PAYROLL represent the total for each department in the WORK.SALARY data set.
D. The values of the variable PAYROLL represent a total for all values of WAGERATE in the WORK.SALARY data set.
Answer is C.
The values of the variable PAYROLL represent the total values of WAGERATE for each department.
The following SAS program is submitted:

libname sasdata 'SAS-data-library';
data test;
set sasdata.chemists (keep = job_code);
if job_code = 'chem3' then description = 'Senior Chemist';
run;

The variable JOB_CODE is a character variable with a length of 6 bytes.

Which one of the following is the length of the variable DESCRIPTION in the output data set?

A. 6 bytes
B. 8 bytes
C. 14 bytes
D. 200 bytes
Answer: C

At compilation time, SAS finds the occurrence of the variable DESCRIPTION for the first time and sets its length as 14 bytes.
The following SAS program is submitted:

data work.accounting;
set work.dept1 work.dept2;
run;

A character variable named JOBCODE is contained in both the WORK.DEPT1 and WORK.DEPT2 SAS data sets. The variable JOBCODE has a length of 5 in the WORK.DEPT1 data set and a length of 7 in the WORK.DEPT2 data set.
Which one of the following is the length of the variable JOBCODE in the output data set?

A. 5
B. 7
C. 8
D. 12
This program concatenates DEPT1 & DEPT2. At compile time, SAS reads all the information (descriptor portion) of DEPT1 first then DEPT2. Therefore, just like SASGuru said, answer is A.
The following SAS DATA step is submitted:

data work.accounting;
set work.department;
length jobcode $ 12;
run;

The WORK.DEPARTMENT SAS data set contains a character variable named JOBCODE with a length of 5. Which one of the following is the length of the variable JOBCODE in the output data set?

A. 5
B. 8
C. 12
D. The length cannot be determined as the program fails to execute due to errors.
It has warning message as following:
WARNING: Length of character variable jobcode has already been set. Use the LENGTH statement as the very first statement in the DATA STEP to declare the length of a character variable.

But it is continue running. Length of variable Jobcode remains 5 bytes. Therefore the answer is A.
Which one of the following SAS statements renames two variables?

A. set work.dept1 work.dept2(rename = (jcode = jobcode) (sal = salary));

B. set work.dept1 work.dept2(rename = (jcode = jobcode sal = salary));

C. set work.dept1 work.dept2(rename = jcode = jobcode sal = salary);

D. set work.dept1 work.dept2(rename = (jcode jobcode) (sal salary));
Answer B

set sas-dataset (rename = (old_name1 = new_name1 old_name2=new_name2));
The following SAS program is submitted:

data work.company;
set work.dept1(keep = jobcode) work.dept2(rename = (jcode = jobcode));
run;

Which one of the following is the result?

A. The variable JCODE is written to the output data set.
B. The variable JOBCODE is written to the output data set.
C. Neither variable JCODE nor JOBCODE is written to the output data set.
D. The program fails to execute due to errors.
The variable JOBCODE is written to the output data set since it is renamed and keep = jobcode)
The following SAS program is submitted:

data work.passengers;
if OrigPassengers = . then OrigPassengers = 100;
TransPassengers = 100;
OrigPassengers = .;
NonPaying = 10;
TotalPassengers = sum (OrigPassengers, TransPassengers);
run;

Which one of the following is the value of the TOTALPASSENGERS variable in the output data set?

A. 100
B. 110
C. 200
D. . (missing numeric value)
Yes, it is true. Answer is "A". If the same IF statement is used after the statement: "OrigPassengers = .;" then the answer would be "C".
The following SAS program is submitted:
data work.passengers;
if OrigPassengers = . then OrigPassengers = 100;
TransPassengers = 100;
OrigPassengers = .;
NonPaying = 10;
TotalPassengers = OrigPassengers + TransPassengers;
run;

Which one of the following is the value of the TOTALPASSENGERS variable in the output data set?

A. 100
B. 110
C. 200
D. . (missing numeric value)
Answer is D.

In a mathematical expression (using arithmetic operators), if one of the operand's values is missing then the value of result is set to missing.

When you use a missing value in an arithmetic expression, SAS sets the result of the expression to missing. If you use that result in another expression, the next result is also missing. In SAS, this method of treating missing values is called propagation of missing values.
The following SAS program is submitted:

data work.staff;
JobCategory = 'FA';
JobLevel = '1';
JobCategory = JobCategory || JobLevel;
run;

Which one of the following is the value of the variable JOBCATEGORY in the output data set?

A. FA
B. FA1
C. FA 1
D. ' ' (missing character value)
A
Here ans is FA only
if we use Job=jobcategory || joblevel then it gives job = FA 1
BUT if we use jobcategory=jobcategory || joblevel then output FA
ones the value assigned for jocategory as FA it should be FA

SO here ans is FA only
The following SAS program is submitted:

data work.one;
x = 3;
y = 2;
z = x ** y;
run;

Which one of the following is the value of the variable Z in the output data set?

A. 6
B. 9
C. . (missing numeric value)
D. The program fails to execute due to errors.
Answer: B

Z=3**2 is 3 to the power of 2 i.e.
The SAS data set named WORK.TEST is listed below:

capacity airplanetype staff
150 Large 10

Which one of the following SAS programs created this data set?

A. data work.test;
capacity = 150;
if 100 le capacity le 200 then airplanetype = 'Large' and staff = 10;
else airplanetype = 'Small' and staff = 5;
run;

B. data work.test;
capacity = 150;
if 100 le capacity le 200 then do;
airplanetype = 'Large';
staff = 10;
end;
else do;
airplanetype = 'Small';
staff = 5;
end;
run;

C. data work.test;
capacity = 150;
if 100 le capacity le 200 then do;
airplanetype = 'Large';
staff = 10;
else do;
airplanetype = 'Small';
staff = 5;
end;
run;

D. data work.test;
capacity = 150;
if 100 le capacity le 200 then;
airplanetype = 'Small';
staff = 5;
else;
airplanetype = 'Large';
staff = 10;
run;
Answer is B.

Multiple statements must enclosed with DO block.
The following SAS program is submitted:

data work.flights;
destination = 'cph';
select(destination);
when('LHR') city = 'London';
when('CPH') city = 'Copenhagen';
otherwise city = 'Other';
end;
run;

Which one of the following is the value of the CITY variable?
A. Other
B. Copenh
C. Copenhagen
D. ' ' (missing character value)
Answer: A

SAS variable are NOT case-sensitive but the DATA IS.
The following SAS program is submitted:

data work.flights;
destination = 'CPH';
select(destination);
when('LHR') city = 'London';
when('CPH') city = 'Copenhagen';
otherwise;
end;
run;

Which one of the following is the value of the CITY variable?

A. London
B. Copenh
C. Copenhagen
D. ' ' (missing character value)
Answer: B

When SAS sees the DESTINATION for the first time i.e. ‘London’ it sets the length to 6 characters…Therefore the value ‘Copenh’ is assigned to DESTINATION becoz of the length.
The SAS data set EMPLOYEE_INFO is listed below:

IDNumber Expenses
2542 100.00
3612 133.15
2198 234.34
2198 111.12

The following SAS program is submitted:

proc sort data = employee_info;

run;

Which one of the following BY statements completes the program and sorts the data sequentially by descending expense values within each descending IDNUMBER value?

A. by descending IDNumber Expenses;
B. by (IDNumber Expenses) descending;
C. by IDNumber descending Expenses descending;
D. by descending IDNumber descending Expenses;
Answer is D.

Please see SASGuru's comment.

And, keep in mind the keyword 'DESCENDING' appears before data set variable.
The SAS data set QTR1_REVENUE is listed below:

destination revenue
YYZ 53634
FRA 62129
FRA 75962
RDU 76254
YYZ 82174

The following SAS program is submitted:

proc sort data = qtr1_revenue;
by destination descending revenue;
run;

Which one of the following represents the first observation in the output data set?

A. destination revenue
YYZ 82174

B. destination revenue
YYZ 53634

C. destination revenue
FRA 62129

D. destination revenue
FRA 75962
D. destination revenue
FRA 75962
The following SAS program is submitted:

libname company 'SAS-data-library';
proc sort data = company.payroll;
by EmployeeIDNumber;
run;

Write access has been granted to the COMPANY library.

Which one of the following represents how the observations are sorted?

A. COMPANY.PAYROLL is recreated in sorted order by EmployeeIDNumber.

B. COMPANY.PAYROLL is stored in original order, and a new data set PAYROLL is created in sorted order by EmployeeIDNumber.

C. COMPANY.PAYROLL is stored in original order, and a new data set
COMPANY.PAYROLLSORTED is created in sorted order by EmployeeIDNumber.

D. COMPANY.PAYROLL is recreated in sorted order by EmployeeIDNumber, and a new data set PAYROLL is created in sorted order by EmployeeIDNumber.
Answer: A

Without the OUT= output dataset option the Proc SORT procedure overwrites the dataset with the new sorted order.
Q14
The SAS data set EMPLOYEE_INFO is listed below:

IDNumber Expenses
2542 100.00
3612 133.15
2198 234.34
2198 111.12

The following SAS program is submitted:

proc sort data = employee_info;
run;

Which one of the following BY statements completes the program and sorts the data sequentially by ascending expense values within each ascending IDNUMBER value?

A. by Expenses IDNumber;
B. by IDNumber Expenses;
C. by ascending (IDNumber Expenses);
D. by ascending IDNumber ascending Expenses;
"by ascending EXPENSES values within each ascending IDNUMBER value" means sorting IDNUMBER first.
The SAS data set WORK.AWARDS is listed below:

fname points
Amy 2
Amy 1
Gerard 3
Wang 3
Wang 1
Wang 2

The following SAS program is submitted:

proc sort data = work.awards;
by descending fname points;
run;

Which one of the following represents how the observations are sorted?

A. Wang 3
Gerard 3
Wang 2
Amy 2
Wang 1
Amy 1

B. Wang 3
Wang 2
Wang 1
Gerard 3
Amy 2
Amy 1

C. Wang 3
Wang 1
Wang 2
Gerard 3
Amy 2
Amy 1

D. Wang 1
Wang 2
Wang 3
Gerard 3
Amy 1
Amy 2
Answer: D
The sort order is descending fname and ascending points.
data awards;
The observations in the SAS data set WORK.TEST are ordered by the values of the variable SALARY.

The following SAS program is submitted:

proc sort data = work.test out = work.testsorted;
by name;
run;

Which one of the following is the result of the SAS program?
A. The data set WORK.TEST is stored in ascending order by values of the NAME variable.
B. The data set WORK.TEST is stored in descending order by values of the NAME variable.
C. The data set WORK.TESTSORTED is stored in ascending order by values of the NAME variable.
D. The data set WORK.TESTSORTED is stored in descending order by values of the NAME variable.
C. The data set WORK.TESTSORTED is stored in ascending order by values of the NAME variable
Which one of the following statements is true regarding the name of a SAS array?

A. It is saved with the data set.
B. It can be used in procedures.
C. It exists only for the duration of the DATA step.
D. It can be the same as the name of a variable in the data set.
Answer: C

SAS Array exists only for the duration of the DATA step
The following SAS program is submitted:

data stats;
set revenue;
array weekly{5} mon tue wed thu fri;

total = weekly{i} * .25;
output;
end;
run;

Which one of the following DO statements completes the program and processes the elements of the WEEKLY array?

A. do i = 1 to 5;
B. do weekly{i} = 1 to 5;
C. do i = mon tue wed thu fri;
D. A DO loop cannot be used because the variables referenced do not end in a digit.
A. do i = 1 to 5;
The following SAS program is submitted:

data work.test;
array agents{4} $ 12 sales1 - sales4;
run;

Which one of the following represents the variables that are contained in the output data set?

A. SALES1, SALES2, SALES3, SALES4
B. AGENTS1, AGENTS2, AGENTS3, AGENTS4
C. None, the DATA step fails because the ARRAY statement can reference only numeric data.
D. None, the DATA step fails because the ARRAY statement can reference only pre-existing variables.
Answer is A.

"array agents{4} $ 12 sales1 - sales4;" statement
is creating 4 character variable sales1-sales with missing value. Output data set has one observation.

"array agents{4} $ 12;" statement
is creating 4 character variable agents1 - agents4 with missing value. Output data set has one observation.
The following SAS program is submitted:

data work.test;
set work.staff (keep = jansales febsales marsales);
array diff_sales{3} difsales1 - difsales3;
array monthly{3} jansales febsales marsales;
run;

Which one of the following represents the new variables that are created?

A. JANSALES, FEBSALES and MARSALES
B. MONTHLY1, MONTHLY2 and MONTHLY3
C. DIFSALES1, DIFSALES2 and DIFSALES3
D. DIFF_SALES1, DIFF_SALES2 and DIFF_SALES3
Answer: C

Tricky, the name of the array diff_sales and the variables mentioned difsales1 - difsales3 look similar but with different spellings.
On which portion(s) of a SAS data set does the PRINT procedure report?

A. the data portion only
B. the descriptor portion only
C. the descriptor portion and the data portion
D. neither the data portion nor the descriptor portion
Answer is A.

The PRINT procedure prints the observations in a SAS data set, using all or some of the variables. You can create a variety of reports ranging from a simple listing to a highly customized report that groups the data and calculates totals and subtotals for numeric variables.
Which one of the following SAS procedures displays the data portion of a SAS data set?

A. PRINT
B. FSLIST
C. CONTENTS
D. DATASETS
FSLIST is used to display an external file from within a SAS session.
LIST procedure does not exist. Hence result = A.
The following SAS program is submitted:

proc datasets lib = sasuser;
contents data = class varnum;
quit;

Which one of the following is the purpose of the VARNUM option?

A. to print a list of variable names
B. to print the total number of variables
C. to print a list of the variables in alphabetic order
D. to print a list of the variables in the order they were created
The VARNUM option produces a list of variable names in the order in which they were defined, which is their logical position in the data set. By default, the CONTENTS statement lists variables alphabetically.
The following SAS program is submitted:

proc contents data = sasuser.airplanes;
run;

Which one of the following is produced as output?
A. the data portion of every data set in the SASUSER library
B. the data portion of the data set SASUSER.AIRPLANES only
C. the descriptor portion of every data set in the SASUSER library
D. the descriptor portion of the data set SASUSER.AIRPLANES only
D. the descriptor portion of the data set SASUSER.AIRPLANES only
A raw data file is listed below:

--------10-------20-------30
John McCloskey 35 71
June Rosesette 10 43
Tineke Jones 9 37

The following SAS program is submitted using the raw data file as input:

data work.homework;
infile 'file-specification';
input name $ age height;
if age LE 10;
run;

How many observations will the WORK.HOMEWORK data set contain?
A. 0
B. 2
C. 3
D. No data set is created as the program fails to execute due to errors.
Answer: C
This is a tricky question…
The values for name have embedded blanks and also no length statement…so the values assigned for age is . (missing) for all obs. And also . (missing) is always le 10. Therefore the output dataset has 3 obs.
data banks;
input name $ age height;
if age LE 10;
cards;
John McCloskey 35 71
June Rosesette 10 43
Tineke Jones 9 37
;
run;
The SASDATA.BANKS data set has five observations when the following SAS program is submitted:

libname sasdata 'SAS-data-library';

data allobs;
set sasdata.banks;
capital=0;
do year = 2000 to 2020 by 5;
capital + ((capital+2000) * rate);
output;
end;
run;

How many observations will the ALLOBS data set contain?

A. 5
B. 15
C. 20
D. 25
SASDATA.BANKS has 5 obs and then the DO loop outputs for 5 (2000, 2005, 2010, 2015, 2020) times. Therefore 5 * 5 = 25 observations output to the ALLOBS.

his is the output what you get after running

Obs rate capital year
1 2 4000 2000
2 2 16000 2005
3 2 52000 2010
4 2 160000 2015
5 2 484000 2020
6 4 8000 2000
7 4 48000 2005
8 4 248000 2010
9 4 1248000 2015
10 4 6248000 2020
11 8 16000 2000
12 8 160000 2005
13 8 1456000 2010
14 8 13120000 2015
15 8 118096000 2020
16 9 18000 2000
17 9 198000 2005
18 9 1998000 2010
19 9 19998000 2015
20 9 199998000 2020
21 10 20000 2000
22 10 240000 2005
23 10 2660000 2010
24 10 29280000 2015
25 10 322100000 2020
The SAS data set named COMPANY.PRICES is listed below:

COMPANY.PRICES

prodid price producttype sales returns

K12S 5.10 NETWORK 15 2
B132S 2.34 HARDWARE 300 10
R18KY2 1.29 SOFTWARE 25 5
3KL8BY 6.37 HARDWARE 125 15
DY65DW 5.60 HARDWARE 45 5
DGTY23 4.55 HARDWARE 67 2

The following SAS program is submitted:

libname company 'SAS-data-library';
data hware inter soft;
set company.prices (keep = producttype price);
if price le 5.00;
if producttype = 'HARDWARE' then output HWARE;
else if producttype = 'NETWORK' then output INTER;
else if producttype = 'SOFTWARE' then output SOFT;
run;

How many observations does the HWARE data set contain?
A. 0
B. 2
C. 4
D. 6
Answer is B.

Filtering by subsetting IF statement (if price le 5.00;)

Resulting only 3 obs (as following) to compare whether PRODUCTTYPE equal to 'HARDWARE' or not.

B132S 2.34 HARDWARE 300 10
R18KY2 1.29 SOFTWARE 25 5
DGTY23 4.55 HARDWARE 67 2
The contents of the raw data file TEAM are listed below:

--------10-------20-------30
Janice 10
Henri 11
Michael 11
Susan 12

The following SAS program is submitted:

data group;
infile 'team';
input name $15. age 2.;
file 'file-specification';
put name $15. +5 age 2.;
run;

Which one of the following describes the output created?

A. a raw data file only
B. a SAS data set named GROUP only
C. a SAS data set named GROUP and a raw data file
D. No output is generated as the program fails to execute due to errors.
Answer is C.

FILE statement specifies the current output file for PUT statements.

PUT statement writes lines to an external location that is specified in the most recent FILE statement.
The following SAS program is submitted:

data allobs;
set sasdata.origin (firstobs = 75 obs = 499);
run;

The SAS data set SASDATA.ORIGIN contains 1000 observations.

How many observations does the ALLOBS data set contain?
A. 424
B. 425
C. 499
D. 1000
Answer: B
Obs count - 499-75
The following SAS program is submitted:

data _null_;
set old (keep = prod sales1 sales2);
file 'file-specification';
put sales1 sales2;
run;

Which one of the following default delimiters separates the fields in the raw data file created?

A. : (colon)
B. (space)
C. , (comma)
D. ; (semicolon)
Answer: B
The default delimiter is space / blank
The following SAS program is submitted:

data _null_;
set old;
put sales1 sales2;
run;

Where is the output written?

A. the SAS log
B. the raw data file that was opened last
C. the SAS output window or an output file
D. the data set mentioned in the DATA statement
answer would be A because there is no file statement.
The contents of the raw data file TEAM are listed below:

--------10-------20-------30
Janice 10
Henri 11
Michael 11
Susan 12

The following SAS program is submitted:

data group;
infile 'team';
input name $15. age 2.;
file 'file-specification';
put name $15. +5 age 2.;
run;

Which one of the following describes the output created?

A. a raw data file only
B. a SAS data set named GROUP only
C. a SAS data set named GROUP and a raw data file
D. No output is generated as the program fails to execute due to errors.
C. a SAS data set named GROUP and a raw data file
The contents of the SAS data set named PERM.STUDENTS are listed below:
name age
Alfred 14
Alice 13
Barbara 13
Carol 14
The following SAS program is submitted using the PERM.STUDENTS data set as input:

libname perm 'SAS-data-library';
data students;
set perm.students;
file 'file-specification';
put name $15. @5 age 2.;
run;
Which one of the following represents the values written to the output raw data file?
A. --------10-------20-------30
Alfred 14
Alice 13
Barbara 13
Carol 14

B. --------10-------20-------30
Alfr14
Alic13
Barb13a
Caro14

C. --------10-------20-------30
Alfr14ed
Alic13e
Barb13ara
Caro14l

D. --------10-------20-------30
Alfred 14
Alice 13
Barbara 13
Carol 14
Answer B
The absolute pointer @5 starts dumping the age values at position 5
The contents of the SAS data set PERM.JAN_SALES are listed below:

VARIABLE NAME TYPE
idnum character variable
sales_date numeric date value

A comma delimited raw data file needs to be created from the PERM.JAN_SALES data set. The SALES_DATE values need to be in a MMDDYY10 form.

Which one of the following SAS DATA steps correctly creates this raw data file?

A. libname perm 'SAS-data-library';
data _null_;
set perm.jan_sales;
file 'file-specification' dsd = ',';
put idnum sales_date : mmddyy10.;
run;

B. libname perm 'SAS-data-library';
data _null_;
set perm.jan_sales;
file 'file-specification' dlm = ',';
put idnum sales_date : mmddyy10.;
run;

C. libname perm 'SAS-data-library';
data _null_;
set perm.jan_sales;
file 'file-specification';
put idnum sales_date : mmddyy10. dlm = ',';
run;

D. libname perm 'SAS-data-library';
data _null_;
set perm.jan_sales;
file 'file-specification';
put idnum sales_date : mmddyy10. dsd = ',';
run;
Answer: B

The answer needs a File statement with dlm=’,’ and input with date format mmddyy10.
A raw data record is shown below:

07Jan2002

Which one of the following informats would read this value and store it as a SAS date value?

A. date9.
B. ddmonyy9.
C. ddMMMyy9.
D. ddmmmyyyy9.
A. date9.
The following SAS program is submitted:

libname temp 'SAS-data-library';

data work.new;
set temp.jobs;
format newdate mmddyy10.;
qdate = qtr(newdate);
ddate = weekday(newdate);
run;

proc print data = work.new;
run;

The variable NEWDATE contains the SAS date value for April 15, 2000.
What output is produced if April 15, 2000 falls on a Saturday?

A. Obs newdate qdate ddate
1 APR152000 2 6

B. Obs newdate qdate ddate
1 04/15/2000 2 6

C. Obs newdate qdate ddate
1 APR152000 2 7

D. Obs newdate qdate ddate
1 04/15/2000 2 7
Answer: D

The WEEKDAY function produces an integer that represents the day of the week, where 1=Sunday, 2=Monday, ..., 7=Saturday.
The following SAS program is submitted:

data work.report;
set work.sales_info;
if qtr(sales_date) ge 3;
run;

The SAS data set WORK.SALES_INFO has one observation for each month in the year 2000 and the variable SALES_DATE which contains a SAS date value for each of the twelve months.

How many of the original twelve observations in WORK.SALES_INFO are written to the WORK.REPORT data set?

A. 2
B. 3
C. 6
D. 9
Answer C

The qtr values of each of the months 7,8,9,10,11,12 is 3,3,3,4.4,4..Therefore 6 obs in the final dataset…
The following SAS program is submitted:

data revenue;
set year_1;
var1 = mdy(1,15,1960);
run;

Which one of the following values does the variable named VAR1 contain?

A. 14
B. 15
C. 1151960
D. '1/15/1960'
Answer: A

1Jan1960 is 0 in SAS
15Jan1960 is 14 in SAS
The following SAS program is submitted:

data work.new;
mon = 3;
day = 23;
year = 2000;
date = mdy(mon,day,year);
run;

Which one of the following is the value of the DATE variable?
A. a character string with the value '23mar2000'
B. a character string with the value '03/23/2000'
C. a numeric value of 14692, which represents the SAS date value for March 23, 2000
D. a numeric value of 3232000, which represents the SAS date value for March 23, 2000
C. a numeric value of 14692, which represents the SAS date value for March 23, 2000
The following SAS DATA step executes on Monday, April 25, 2000:

data newstaff;
set staff;
start_date = today();
run;

Which one of the following is the value of the variable START_DATE in the output data set?

A. a character string with the value '04/25/2000'
B. a character string with the value 'Monday, April 25, 2000'
C. the numeric value 14725, representing the SAS date for April 25, 2000
D. the numeric value 04252000, representing the SAS date for April 25, 2000
C. the numeric value 14725, representing the SAS date for April 25, 2000
The following SAS DATA step is submitted:

data sasdata.atlanta sasdata.boston work.portland work.phoenix;
set company.prdsales;
if region = 'NE' then output boston;
if region = 'SE' then output atlanta;
if region = 'SW' then output phoenix;
if region = 'NW' then output portland;
run;

Which one of the following is true regarding the output data sets?
A. No library references are required.
B. The data sets listed on all the IF statements require a library reference.
C. The data sets listed in the last two IF statements require a library reference.
D. The data sets listed in the first two IF statements require a library reference.
Answer D

The datasets in the first two IF statements require “sasdata” libref
Which one of the following SAS DATA steps saves the temporary data set named MYDATA as a permanent data set?

A. libname sasdata 'SAS-data-library';
data sasdata.mydata;
copy mydata;
run;

B. libname sasdata 'SAS-data-library';
data sasdata.mydata;
keep mydata;
run;

C. libname sasdata 'SAS-data-library';
data sasdata.mydata;
save mydata;
run;

D. libname sasdata 'SAS-data-library';
data sasdata.mydata;
set mydata;
run;
Answer: D
The answer requires a SET stateme
The following SAS DATA step is submitted:

libname temp 'SAS-data-library';
data temp.report;
set sasuser.houses;
newvar = price * 1.04;
run;

Which one of the following statements is true regarding the program above?

A. The program is reading from a temporary data set and writing to a temporary data set.
B. The program is reading from a temporary data set and writing to a permanent data set.
C. The program is reading from a permanent data set and writing to a temporary data set.
D. The program is reading from a permanent data set and writing to a permanent data set.
Answer would be D because only work is a temporary library which stores data temporarily ,other than that all library references stores data permanently ,here sasuser and temp are used both will store data permanently and will create permanent data set.
The following SAS SORT procedure step generates an output data set:

proc sort data = sasuser.houses out = report;
by style;
run;

In which library is the output data set stored?

A.WORK
B.REPORT.
C.HOUSES
D.SASUSER
Answer A
Without library reference its going its saved in Work library
The following SAS program is submitted:

proc sort data=work.employee;
by descending fname;

proc sort data=work.salary;
by descending fname;

data work.empdata;
merge work.employee work.salary;
by fname;
run;

Which one of the following statements explains why the program failed execution?

A. The SORT procedures contain invalid syntax.
B. The merged data sets are not permanent SAS data sets.
C. The data sets were not merged in the order by which they were sorted.
D. The RUN statements were omitted after each of the SORT procedures.
Answer C. You sorted in descending order (the sort procedures will work fine because they encounter another step, messy programming, but it works). Then you tried to merge in ascending order.
The SAS data sets WORK.EMPLOYEE and WORK.SALARY are listed below:

WORK.EMPLOYEE
fname age

Bruce 30
Dan 40

WORK.SALARY
fname salary

Bruce 25000
Bruce 35000
Dan 25000

The following SAS program is submitted:

data work.empdata;
merge work.employee work.salary;
by fname;
totsal + salary;
run;

How many variables are output to the WORK.EMPDATA data set?
A. 3
B. 4
C. 5
D. No variables are output to the data set as the program fails to execute due to errors.
Answer: B

Name age salary totsal
Bruce 30 25000 25000
Bruce 30 35000 60000
Dan 40 25000 85000
The contents of two SAS data sets named EMPLOYEE and SALARY are listed below:


EMPLOYEE SALARY
Bruce 30
Dan 35
NAME AGE NAME SALARY

Bruce 40000
Bruce 35000
Dan 37000
Dan .

data emplsal;
merge employee (in=ine) salary(in=ins);
by name;
if ine and ins;
run;

How many observation are in EMPLSAL dataset
A. 4
B. 3
c. 2
D. 1
Answer A
This is an example of one-many relationship merge.
The resultant dataset will have

Name age salary

Bruce 30 40000
Bruce 30 35000
Dan 35 37000
Dan 35 .
The following SAS program is submitted:

data work.empsalary;
set work.people (in = inemp) work.money (in = insal);
if insal and inemp;
run;

The SAS data set WORK.PEOPLE has 5 observations, and the data set WORK.MONEY has 7 observations.

How many observations will the data set WORK.EMPSALARY contain?
A. 0
B. 5
C. 7
D. 12
Answer: A
Since there is no BY statement..this is an example of concatenation…there is no match between each of the datasets…therefore 0 records in the output dataset
The following SAS program is submitted:

data numrecords;

infile 'file-specification';
input @1 patient $15. relative $ 16-26 @;
if relative = 'children' then input @54 diagnosis $15. @;

else if relative = 'parents' then input @28 doctor $15. clinic $ 44-53 @54 diagnosis $15. @;
input age;
run;
How many raw data records are read in each iteration of the DATA step during execution?

A. 1
B. 2
C. 3
D. 4
Answer: A
Here we need to determine how many records will each iteration read from the raw data file.
Remember the trailing @ definition, the next input statement will read from the current record in the same datastep iteration…So when we are using @ the total number of iterations would be directly proportional to the number of records in the raw data file….
Take a hard look at each of the input statements the record ends a position 54 for diagnosis variable and a trailing @…so the variable age reads at probably 69 or before depending on the length of diagnosis…So each iteration would require only record from the data file.
A raw data file is listed below:

RANCH,1250,2,1,Sheppard Avenue,"$64,000"
SPLIT,1190,1,1,Rand Street,"$65,850"
CONDO,1400,2,1.5,Market Street,"80,050"
TWOSTORY,1810,4,3,Garris Street,"$107,250"
RANCH,1500,3,3,Kemble Avenue,"$86,650"
SPLIT,1615,4,3,West Drive,"94,450"
SPLIT,1305,3,1.5,Graham Avenue,"$73,650"

The following SAS program is submitted using the raw data file as input:

data work.condo_ranch;
infile 'file-specification' dsd;
input style $ @;
if style = 'CONDO' or style = 'RANCH' then
input sqfeet bedrooms baths street $ price : dollar10.;
run;

How many observations does the WORK.CONDO_RANCH data set contain?


A. 0
B. 3
C. 5
D. 7
Answer: D
Remember the trailing @ definition, the next input statement will read from the current record in the same datastep iteration…So when we are using @ the total number of iterations would be directly proportional to the number of records in the raw data file….
The input statement in line 3 has a @..but it does not have a effect here…because @ holds the current record for the same iteration in the datastep.
The contents of the raw data file FURNITURE are listed below:

--------10-------20-------30
chair,,table
chair,couch,table

The following SAS program is submitted:


data stock;
infile 'furniture' dsd;
input item1 $ item2 $ item3 $;
run;


Which one of the following is the value of the variable named ITEM2 in the first observation of the output data set?
A. table
B. ,table
C. . (missing numeric value)
D. ' ' (missing character value)
Answer D
Item2 is defined as character and the dsd option will assign missing value to it as there are two commas.
The following SAS program is submitted and reads 100 records from a raw data file:

data work.total;
infile 'file-specification' end = eof;
input name $ salary;
totsal + salary;
run;

Which one of the following IF statements writes the last observation to the output data set?

A. if end = 0;
B. if eof = 0;
C. if end = 1;
D. if eof = 1;
Answer D
if eof = 1; identifies the last observation in the dataset
The following SAS program is submitted:

libname rawdata1 'location of SAS data library';
filename rawdata2 'location of raw data file';


data work.testdata;
infile
input sales1 sales2;
run;

Which one of the following is needed to complete the program correctly?


A. rawdata1
B. rawdata2
C. 'rawdata1'
D. 'rawdata2'
B, concur with guru. The key here is the filename statement. This creates what's called a fileref, which is essentially a nickname given to something, in this case a raw data file. Because the filename had quotes, the fileref does too. Don't belive me, check out this example from SAS help.
A raw data record is listed below:
--------10-------20-------30
son,Travis,

The following output is desired:
relation firstname
son Travis

Which one of the following SAS programs reads the data correctly?


A. data family / dlm = ',';
infile 'file-specification';
input relation $ firstname $;
run;


B. options dlm = ',';
data family;
infile 'file-specification';
input relation $ firstname $;
run;


C. data family;
infile 'file-specification' dlm = ',';
input relation $ firstname $;
run;


D. data family;
infile 'file-specification';
input relation $ firstname $ / dlm = ',';
run;
Answer C
The contents of the raw data file TYPECOLOR are listed below:


---------10--------20--------30
daisyyellow


The following SAS program is submitted:


data flowers;
infile 'typecolor';
input type $ 1-5 +1 color $;
run;


Which one of the following represents the values of the variables TYPE and COLOR?
A. type color
daisy yellow

B. type color
daisy ellow

C. type color
daisyyellow (missing character value)

D. No values are stored as the program fails to execute due to syntax errors.
Answer: B
data flowers;
input type $ 1-5 +1 color $;
cards;
daisyyellow
;
run;
NOTE- Underscore represent blank space

The contents of the raw data file PRODUCT are listed below:

--------10-------20-------30
24613____$25.31

The following SAS program is submitted:

data inventory;
infile 'product';
input idnum 5. @10 price;
run;

Which one of the following is the value of the PRICE variable?

A. 25.31
B. $25.31
C. . (missing numeric value)
D. No value is stored as the program fails to execute due to errors.
Answer is (C).
Because program creates the data set and read the first value, however, fails to read the value for price.
The following SAS program is submitted:

proc print data = sasuser.houses;
run;

proc means data = sasuser.shoes;
run;

Which one of the following OPTIONS statements resets the page number to 1 for the second report?


A. options pageno = 1;
B. options pagenum = 1;
C. options reset pageno = 1;
D. options reset pagenum = 1;
Answer: A
The following SAS program is submitted:

data work.sets;
do until (prod gt 6);
prod + 1;
end;
run;

Which one of the following is the value of the variable PROD in the output data set?

A. 5
B. 6
C. 7
D. 8
The value for prod is not provided so it will consider it to be zero..
Answer: C
Which one of the following is true of the SUM statement in a SAS DATA step program?

A. It is only valid in conjunction with a SUM function.
B. It is not valid with the SET, MERGE and UPDATE statements.
C. It adds the value of an expression to an accumulator variable and ignores missing values.
D. It does not retain the accumulator variable value from one iteration of the SAS DATA step to the next.
Answer: C
The following SAS program is submitted:

data work.new;
length word $7;
amount = 7;
if amount = 5 then word = 'CAT';
else if amount = 7 then word = 'DOG';
else word = 'NONE!!!';
amount = 5;
run;

Which one of the following represents the values of the AMOUNT and WORD variables?
A. amount word
5 DOG


B. amount word
5 CAT


C. amount word
7 DOG

D. amount word
7 ' ' (missing character value)
Agree with A. Though it might be more clear to say that because it comes after the processing of the variable word, amount = 5's only effect is to change the value of that one variable.
When the following SAS program is submitted, the data set SASDATA.PRDSALES contains 5000 observations:

libname sasdata 'SAS-data-library';
options obs = 500;

proc print data = sasdata.prdsales (firstobs = 100);
run;

options obs = max;
proc means data = sasdata.prdsales (firstobs = 500);
run;

How many observations are processed by each procedure?
A. 400 for PROC PRINT 4500 for PROC MEANS
B. 401 for PROC PRINT 4501 for PROC MEANS
C. 401 for PROC PRINT 4500 for PROC MEANS
D. 500 for PROC PRINT 5000 for PROC MEANS
B.
The reason is that it will go from firstobs to obs, inclusive. So it will count 100, 101, 102, ... 499, and 500. Just one of those funny math things you've got to watch out for.
In the following SAS program, the input data files are sorted by the NAMES variable:

libname temp 'SAS-data-library';
data temp.sales;
merge temp.sales work.receipt;
by names;
run;

Which one of the following results occurs when this program is submitted?
A. The program executes successfully and a temporary SAS data set is created.
B. The program executes successfully and a permanent SAS data set is created.
C. The program fails execution because the same SAS data set is referenced for both read and write operations.
D. The program fails execution because the SAS data sets on the MERGE statement are in two different libraries.
Answer: B
Even if the same named datasets are used in read and write, SAS first builds the observations in temporary memory and then overwrites the dataset
A raw data record is listed below:

--------10-------20-------30
Printing 750

The following SAS program is submitted:


data bonus;
infile 'file-specification';
input dept $ 1 - 11 number 13 - 15;
run;

Which one of the following SAS statements completes the program and results in a value of 'Printing750' for the DEPARTMENT
variable?
A. department = trim(dept) number;
B. department = dept input(number,3.);
C. department = trim(dept) || put(number,3.);
D. department = input(dept,11.) || input(number,3.);
Answer C

You would need trim to remove trailing blanks for dept and put() for converting numeric 750 to character
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?
A. duration = today( ) - put(date,ddmmyy10.);
B. duration = today( ) - put(date,yymmdd10.);
C. duration = today( ) - input(date,ddmmyy10.);
D. duration = today( ) - input(date,yymmdd10.);
Answer: D
The input date is character variable whose value should be converted to numeric using the input function with the yymmdd10. Informat.
The following SAS program is submitted:


data work.sales;
do year = 1 to 5;
do month = 1 to 12;
x + 1;
end;
end;
run;


Which one of the following represents how many observations are written to the WORK.SALES data set?
A. 0
B. 1
C. 5
D. 60
Answer B
Since there is NO explicit OUTPUT statement the output will have 1 obs only