Loading...

Advanced SAS FAQs


1. Which of these is false? Ranges in the VALUE statement can specify… 
1. a single value, such as 24 or ‘S’
2. a range of numeric values, such as 0-1500.
3.  a range of character values, such as ‘A’-‘M’.
4. a list of numeric and character values separated by commas, such as 90,’B’,180,’D’,270. 
Ans :
Explanation : You can list values separated by commas, but the list must contain either all numeric values or all character values. Data set variables are either numeric or character. 

2. When creating a format with the VALUE statement, the new format’s name
  cannot end with a number
  cannot end with a period
– cannot be the name of a SAS format, and… 
1.  cannot be the name of a data set variable.
2.  must be at least two characters long.
3.  must be at least eight characters long.
4.  must begin with a dollar sign ($) if used with a character variable 
Ans : 4 
Explanation  : The name of a format that is created with a VALUE statement must begin with a dollar sign ($) if it applies to a character variable. 

3. Which keyword can be used to label missing numeric values as well as any values that are not specified in a range? 
1.     LOW
2.     MISS
3.     MISSING
4.     OTHER
Ans :
Explanation : MISS and MISSING are invalid keywords, and LOW does not include missing numeric values. The keyword OTHER can be used in the VALUE statement to label missing values as well as any values that are not specifically included in a range. 

4. Which keyword, when added to the PROC FORMAT statement, will display all the formats in your catalog?
1.    nbsp; nbsp; CATALOG
2.    nbsp; nbsp; LISTFMT
3.    nbsp; nbsp; FMTCAT
4.    nbsp; nbsp; FMTLIB
Ans  :
Explanation : Adding the keyword FMTLIB to the PROC FORMAT statement displays a list of all the formats in your catalog, along with descriptions of their values. 

Advanced-SAS-FAQs

5. Which of the following statements is false regarding the program shown below?
data work.hadoopexam;
do year=1990 to 2004;
Capital+5000;
capital+(capital*.10);
output;
end;
run;
1. The OUTPUT statement writes current values to the data set immediately.
2. In this case last value for Year in the new data set is 2005.
3. The OUTPUT statement overrides the automatic output at the end of the DATA step.
4. The DO loop performs 15 iterations. 
Ans : 2
Explanation: The OUTPUT statement overrides the automatic output at the end of the DATA step. On the last iteration of the DO loop, the value of Year, 2004, is written to the data set. Using OUTPUT without arguments causes the current observation to be written to all data sets that are named in the DATA statement.
The OUTPUT statement tells SAS to write the current observation to a SAS data set immediately, not at the end of the DATA step. If no data set name is specified in the OUTPUT statement, the observation is written to the data set or data sets that are listed in the DATA statement. 

6. How many characters can be used in a label? 
1.     40
2.     96
3.     200
4.     256 
Ans :
Explanation : When specifying a label, enclose it in quotation marks and limit the label to 256 characters. 

7. Which one of the following SAS DATA steps saves the temporary data set named HADOOPDATA as a permanent data set? 
1. libname sasdata ‘SAS-data-library';
data sasdata.hadoopdata;
copy hadoopdata;
run;
2. libname sasdata ‘SAS-data-library';
data sasdata.hadoopdata;
keep hadoopdata;
run;
3. libname sasdata ‘SAS-data-library';
data sasdata.hadoopdata;
save hadoopdata;
run;
4. libname sasdata ‘SAS-data-library';
data sasdata.hadoopdata;
set hadoopdata;
run; 
Ans :
Explanation : COPY statement exists in SAS. However, it cannot be used inside a Data step so A is not a correct answer.
COPY statement cannot be used in datastep. It is used in a proc step as follow:
proc copy in=work out=sasuser;
select datasetname;
run;
Required Arguments
OUT=libref-1
names the SAS library to copy SAS files to.
Aliases: OUTLIB= and OUTDD=
Featured in: Manipulating SAS Files
IN=libref-2
names the SAS library containing SAS files to copy.
Aliases: INLIB= and INDD=
Default: the libref of the procedure input library
To copy only selected members, use the SELECT or EXCLUDE statements. 

8. Which of the following would you use to compare the result of investing 4,000INR a year for five years in three different banks that compound interest monthly? Assume a fixed rate for the five-year period. 
1. DO WHILE statement
2. nested DO loops
3. DO UNTIL statement
4. a DO group 
Ans :
Explanation : Place the monthly calculation in a DO loop within a DO loop that iterates once for each year. The DO WHILE and DO UNTIL statements are not used here because the number of required iterations is fixed. A non-iterative DO group would not be useful. a DO loop within another DO loop is called nesting. 

9. The format JOBFMT was created in a FORMAT procedure. Which FORMAT statement will apply it to the variable JobTitle in the program output? 
1.     format jobtitle jobfmt;
2.     format jobtitle jobfmt.;
3.     format jobtitle=jobfmt
4.     format jobtitle=’jobfmt'; 
Ans : 2
Explanation : To associate a user-defined format with a variable, place a period at the end of the format name when it is used in the FORMAT statement.
VirtualNuggets 4246110127333020393

Post a Comment

emo-but-icon

Home item

Blog Archive

Popular Posts

Random Posts

Flickr Photo