Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1. The following is an example of.... (Choose one)
data employee;
infile 'employee.dat'; /* Assuming directory-based system */
input id $6. name $20. @30 locale $10.;
run;
A. List
B. Column
C. Formatted
D. Mixed
E. Standard
3. Which of the following are valid statements concerning reading raw data files using list input: (Choose all
that apply)
A. The DLM= is an option for the infile statement for specifying delimiters.
B. All variables have a default length of 8 bytes.
C. When the input statement runs into an end-of-line marker, it stops reading data even
though there are more fields specified.
D. You use a $ after a variable name to specify a character variable.
E. Fields are read from left to right.
4. Given the following raw data file, offices.dat, in a directory-based system, which data step would create a
SAS data set with one observation for each region: (Choose One)
1122334
1234567890123456789012345678901234567890
East Maryland Vermont Maine
Central Illinois Iowa Kansas Missouri
West California Washington
A.
data offices;
infile 'offices.dat' stopover;
input region $ state1-state4 $;
run;
B.
data offices;
infile 'offices.dat' missover;
input region $ (state1-state4) ($);
run;
C.
data offices;
infile 'offices.dat' delim=" ";
input region $ state1 $ state2 $ state3 $ state4 $;
run;
D.
data offices;
infile 'offices.dat';
input region $ state1-state4 $.;
run;
E. None of the above.
5. The double trailing "@@" in an input statement...(Choose all that apply)
A. holds the current data line in the buffer for another input statement to process
B. can be used to read multiple observations from a single data line
C. loads a new record into the input buffer if an end-of-record is found in the current record
D. is a syntax error.
E. None of the above.
6. Which SAS statement below wil change the characteristics of a variable if it was used in a data step?
A. SCAN
B. ATTRIB
C. FORMAT
D. PUT
E. ARRAY
8. Given a data file with 100 columns of data, you only need to read in the first 70 colums. Which of the
following could you use:
A. infile x line = 70;
B. infile x length = 71;
C. infile x missover = 70;
D. infile x ls=70;
E. infile x linesize=70;
If the DATA step below is executed, what will be the value of the variable JOBDESC in the output SAS data
set when this observation is processed:
data navigate;
set employees;
if jobcode = 'NA1' then jobdesc = 'Navigator';
run;
A. navigator
B. Navigator
C. NAVIGATOR
D. a missing value
proc format;
value score 1 - 50 = 'Fail'
51 - 100 = 'Pass';
run;
Which one of the following PRINT procedure steps correctly applies the format?
Upon completion of execution, what are the values of the variables X and INDEX in the SAS data set named
LOOP?
A. x = 3, index = 3
B. x = 3, index = 4
C. x = 5, index = 5
D. x = 5, index = 6
E. x = 5, index = 7
15 Given that the data set named ONE contains 10 observations and the data set named TWO contains 10
observations, how many observations will be contained in the data set named COMBINE that is created in
the following DATA step?
data combine;
set one two;
run;
A. 10
B. 20
C. 0, the DATA step will fail due to syntax errors
D. 10 to 20, depending on how many observations match
GO TOP
c c
1. A format statement should be specified before the CARDS statement when we read internal raw data.
a. True
b. False
2. An external file with a maximum record length of 225 is read into SAS in a DATA step. Select all
statements that reads the data correctly.
3. Select the False statement about List Input method of reading data
a. Reads data separated by several spaces.
b. Does not skip over unwanted values in the input data.
c. Reads a date.
4. Column Input style can read a character data value with space embedding
a. True
b. False
5. A standard numeric data in SAS can contain a µ-µ (negative) sign and µE¶ for scientific notations
a. True
b. False
6. A non standard data (Numbers with comma, dates like ¶03-OCT-2005¶ ) can be read with the following
INPUT styles (select all correct answers)
a. Formatted Input
b. Modified List Input
c. Using Informats in INPUT statement
7. Given the line of raw data:
112233 SCODES Z M N
When executed in a DATA step correctly, what value the variable µStatuscodes¶ gets?
a. Z
b. Z M N
c. . (Missing)
Data Test;
INPUT accnum $ / fname $ lname $ ;
cards;
12223242 Johny Smith
Peter Smith Thomas Joseph
;run;
11. Datafile µc:\mydata.dat¶ contains account number, first name and last name of account holders with
following structure.
a. Data Test;
INFILE 'c:\mydata.dat' MISSOVER;
INPUT accnum $ 1-6 fname $ 8-14 lname $ 16-20;
run;
b. Data Test;
INFILE 'c:\mydata.dat' TRUNCOVER;
INPUT accnum $ 1-6 fname $ 8-14 lname $ 16-20;
run;
c. Data Test;
INFILE 'c:\mydata.dat' ;
INPUT accnum $ fname $ lname $;
run;
Data Test;
INFILE 'c:\mydata.dat¶;
INPUT client_id $ 1-3 @;
IF client_id 'JCP' then delete;
INPUT accnum $ 4-8 fname $ 9-14 lname $ 16-20;
run;
a. None
b. 3
c. 4
13. An external data file has account open date in the following format .
01-13-95
01-14-96
01-15-97
Which of the following is a correct INPUT statement in DATA step to read this data.
a. INPUT Account_no mmddyy8. ;
b. INPUT Account_no mmddyy6. ;
c. INPUT Account_no ddmmyy8. ;
Data Test;
today = '20dec2005'd;
format today mmddyy10.;
run;
GO TOP
c c
Note: the programs in the example e expects no errors due to improper use of ;, µ¶, ) etc.
1. File C:\mydata.dat contains 100 complete records and the following program is submitted.
options obs=10;
Data Test;
INFILE 'c:\mydata.dat' firstobs=3;
INPUT accnum $ fname $ lname $;
run;
Data Test;
INFILE 'c:\mydata.dat' DLM='$' DSD ;
INPUT accnum $ fname $ lname $;
run;
a. It does not treat µ$¶ character as part of the data value and treat it as delimiter.
b. It recognize two consecutive µ$¶ characters as a missing value for the variable read
c. If data value is specified in quotes with embedded µ$¶ character DSD option treats it as part of the data.
3. A PROC DATATSETS is used as follows(assumption: all libraries are and datasets are existing):
a. It lists all SAS data files with file size and date modified in µmylib¶ library and makes a copy of µscoredata¶
file in µrloc¶ library and deletes µtension¶ dataset..
b. It lists all SAS data files with file size and date modified in µmylib¶ library and deletes µtension¶ file from
µrloc¶ library.
c. It lists all SAS data files with file size and date modified in µmylib¶ library and makes a copy of µscoredata¶
file in µrloc¶ library and also copies the µscoredata¶ file in µrloc¶ library.
d. It lists all sas data files with file size and date modified in µmylib¶ library and makes a copy of µscoredata¶
file in µrloc¶ library.
4. The following program is submitted. Which is a false statement about the output of this program?
Data xx;
Set yy;
attrib status_codes length=$4 label ='Status Codes' format =$upcase8.;
run;
If yy has a variable names status_codes and the user wants the attributes to be changed in xx . Will this
statement change the length, label and format in xx dataset?
a. YES
b. NO
c. No Sufficient Information
6. The below three program blocks are submitted
A) Data target_data ;
Set base_data((keep = var1 var2 var3 );
Run;
B) Data target_data ;
Set base_data;
keep = var1 var2 var3 ;
Run;
If the user needs only var1, var2 and var3 to work with, which step is most efficient?
a. A
b. B
c. C
d. A&B
e. None
7. The following program is submitted (Assumption is os_dollars is an existing dataset with client groups
(client_group) and dollar outstanding (os) fields. ) .
Data test;
SET os_dollars END=FIN ;
BY client_group;
t_os +os;
IF LAST.clinet_group THEN DO ;
g_os +t_os ;
t_os=0;END;run;
a. Computes the gross outstanding across the groups and store it in g_os variable, last row.
b. Computes the oustandings for client groups and retain them in t_os variable
c. None of the above.
A) Obs my_number
1 1234
2 9
B) Obs my_number
1 1234
2 0009
C) Obs my_number
. .
x='20jan94'd;
y=qtr(x);
put y=;
a. 1
b. 2
c. 3
d. None
data xx;
date1=122591;
date2=put(date1,z6.);run;
11. The following statement forms a part of SAS dataset (no syntax errors)
Data xx;
Set yy;
array weight wt1-wt50;
do i=1 to 50;
if weight{i}=999 then weight{i}=¶missing¶;
end;
run;
a. Creates a variable weight and assigns w1-wt50 (wt1, wt2, wt3 etc)
b. Variables named wt1-wt50 exist in the¶ yy¶ data set.
c. If any of the fields in wt1-wt50 have a value of µ999¶ then it will be reset with a µmissing¶ .
d. Evaluated all 50 fields and the entire table looking for value µ999¶ in any of the fields
GO TOP