base sas interview questions by topic

15
Flat No: 212, 2nd floor, Annapurna Block, Aditya Enclave, Ameerpet, Hyderabad-16. E-mail: [email protected] Tel: +9140 6462 6789, +91 998 570 6789 Online and Classroom Trainings for SAS, SAS BI Base Sas / Advance SAS Interview Questions 1. How many data types are there in SAS? Sas has only Two Data Types Character Numeric Read class notes to understand the storage values / length / missing values representation 2. If a variable contains only numbers, can it be character data type? Also give example? Yes, character data type can store Letters(A-Z,a-z) or Number (0-9) or Spl Char(!@#$%^&*()) or Combination of these. If Numbers are stored as character data type then we cannot perform any mathematical expression. Addl Information: To perform mathematical expressions then use INFORMAT to convert into standard numeric data value and numeric data type. 3. If a variable contains letters or special characters, can it be numeric data type? Not possible, it can only be character data type. 4. How to read excel worksheet in SAS? 5. What version of SAS are you currently using? 6. Describe your familiarity with SAS Formats / Informats. 7. Data statement options at least any 3 options. Drop = , Keep = , Rename= , Where = , Firstobs = , Obs = 8. What system options are you familiar with? - SAS system options are initialized with default settings when SAS is invoked - an option that affects the processing of an entire SAS program or interactive SAS session from the time the option is specified until it is changed. Options nodate notime linesize= pagesize = ; Options date time ; 9. For what purposes do you use DATA _NULL_? 10. Name at least five compile time statements? During Compilation of Data Step syntax scan SAS source code translation to machine language definition of input and output files creation of tools: i. input buffer (if reading any non-SAS data), ii. Logical Program Data Vector (LPDV), iii. and data set descriptor information

Upload: sneha-nagaruru

Post on 18-Jan-2016

56 views

Category:

Documents


7 download

DESCRIPTION

interview ques

TRANSCRIPT

Page 1: Base Sas Interview Questions by Topic

Flat No: 212, 2nd floor, Annapurna Block, Aditya Enclave, Ameerpet, Hyderabad-16. E-mail: [email protected] Tel: +9140 6462 6789, +91 998 570 6789

Online and Classroom Trainings for SAS, SAS BI

Base Sas / Advance SAS Interview Questions

1. How many data types are there in SAS?

Sas has only Two Data Types

Character

Numeric

Read class notes to understand the storage values / length / missing values

representation

2. If a variable contains only numbers, can it be character data type? Also give

example?

Yes, character data type can store Letters(A-Z,a-z) or Number (0-9) or Spl

Char(!@#$%^&*()) or Combination of these. If Numbers are stored as character

data type then we cannot perform any mathematical expression.

Addl Information: To perform mathematical expressions then use INFORMAT to

convert into standard numeric data value and numeric data type.

3. If a variable contains letters or special characters, can it be numeric data type?

Not possible, it can only be character data type.

4. How to read excel worksheet in SAS?

5. What version of SAS are you currently using?

6. Describe your familiarity with SAS Formats / Informats.

7. Data statement options at least any 3 options.

Drop = , Keep = , Rename= , Where = , Firstobs = , Obs =

8. What system options are you familiar with?

- SAS system options are initialized with default settings when SAS is invoked

- an option that affects the processing of an entire SAS program or interactive SAS

session from the time the option is specified until it is changed.

Options nodate notime linesize= pagesize = ;

Options date time ;

9. For what purposes do you use DATA _NULL_?

10. Name at least five compile time statements?

During Compilation of Data Step

syntax scan

SAS source code translation to machine language

definition of input and output files

creation of tools:

i. input buffer (if reading any non-SAS data),

ii. Logical Program Data Vector (LPDV),

iii. and data set descriptor information

Page 2: Base Sas Interview Questions by Topic

Flat No: 212, 2nd floor, Annapurna Block, Aditya Enclave, Ameerpet, Hyderabad-16. E-mail: [email protected] Tel: +9140 6462 6789, +91 998 570 6789

Online and Classroom Trainings for SAS, SAS BI

determining variable attributes for output SAS data set

capturing variables to be initialized to missing

Compile Time Statements:

Location irrelevant:

drop, keep, rename

label`

retain

Location critical:

length

format, informat

array

by

where

11. State different ways of getting data into SAS?

Methods for getting your data into SAS can be put into four general categories:

Entering data directly into SAS data sets

Creating SAS data sets from raw data files

Converting other software‟s data files into SAS data sets

Reading other software‟s data files directly ( Proc Sql Pass-Through

Facility)

12. Can you state some special input delimiters?

DLM= or Delimiter =

DLMSTR = This option enables programmers to specify a multi-character string

as a delimiter. For example, DLMSTR="-/-" treats these three characters, in this

order, as a delimiter. Prior to this option, each individual character specified in the

DLM= option would have been treated singularly as a delimiter.

13. Which gets applied first when using the keep= and rename= data set options on

the same data set?

DROP= and KEEP= options are applied before the RENAME= option.

Next, DROP and KEEP statements are applied, followed by the RENAME

statement.

14. What option in PROC FORMAT allows you to create a format from an input

control data set rather than VALUE statement?

15. State different ways of combining sas datasets?

Concatenation

Interleaving

One to One Reading

One to One Merging

Match Merging (Types : one to one, many to many, one to many or many to one)

Update

Page 3: Base Sas Interview Questions by Topic

Flat No: 212, 2nd floor, Annapurna Block, Aditya Enclave, Ameerpet, Hyderabad-16. E-mail: [email protected] Tel: +9140 6462 6789, +91 998 570 6789

Online and Classroom Trainings for SAS, SAS BI

Modify

16. What is Concatenation ? what is Interleaving ? Difference between Concatenation

and Interleaving?

17. Types of Merge? How to merge two data sets?

18. What is the difference between One to One Merge and Match Merge? Give

example also..

19. How can you combine two datasets based on the relative position of rows in each

data set; that is, the first observation in one data set is joined with the first

observation in the other, and so on?

One to One Reading (if both datasets have equal number of observations)

One to One Merging without Key Variable (if datasets have unequal

number of observations

20. What would be the format of Revenue in resulting dataset?

data concat;

set a b;

run;

Format of variable Revenue in dataset a is dollar10.2 and format of variable

Revenue in dataset b is dollar12.2

Ans: Dollar10.2

21. If you have two datasets you want to combine them in the manner such that

observations in each BY group in each data set in the SET statement are read

sequentially, in the order in which the data sets and BY variables are listed then

which method of combining datasets will work for this?

Ans: Interleaving

22. It is possible to use the MERGE statement without a BY statement? Explain?

23. I have a dataset concat having variable a b & c. How to rename a b to e & f?

Renaming a variable using Rename as dataset option or Statement:

Data concat (rename=(a=e b=f));

Set concat;

Run;

24. What is difference between appending and concatenating? Or Append and set

difference

Page 4: Base Sas Interview Questions by Topic

Flat No: 212, 2nd floor, Annapurna Block, Aditya Enclave, Ameerpet, Hyderabad-16. E-mail: [email protected] Tel: +9140 6462 6789, +91 998 570 6789

Online and Classroom Trainings for SAS, SAS BI

25. What is interleaving?

26. How many datasets can be merged at a time using MERGE statement?

27. What does the difference between combining 2 datasets using multiple SET

Statement and MERGE statement with common key variable or without common

key variable?

28. Set and Merge Difference

While the SET statement reads observations from one data set at the time, the

MERGE statement reads from two or more data sets simultaneously

29. How do I remove duplicate observations from my data set?

1. You can use Proc Sort with option Nodup to remove duplicate observations for

all variables or with option NodupKey to remove duplicate observations for By

key variables only from your data set.

2. Dupout is a new option in Proc Sort. It names a SAS data set that will

contain the duplicate records eliminated from the data set.

3. You can also use FIRST. and LAST. variables in a data step to remove duplicate

observations.

30. How would you delete duplicate observations?

NODUP

31. How would you delete observations with duplicate keys?

NODUPKEY

32. How to display duplicated observations in a data using base sas?

There are two ways to display duplicate observations.

1) In data step, using first.var and last.var

Page 5: Base Sas Interview Questions by Topic

Flat No: 212, 2nd floor, Annapurna Block, Aditya Enclave, Ameerpet, Hyderabad-16. E-mail: [email protected] Tel: +9140 6462 6789, +91 998 570 6789

Online and Classroom Trainings for SAS, SAS BI

2) Using proc sort with option dupout option

33. Rename= option and Rename as a Statement?

34. What is difference between proc means and proc summary?

35. What is use of output statement?

36. What is the purpose of trailing @ and @@?

37. What are Report Procedures? or What are Summary Procedures ? Can you name

some report procedures that you have used in your project and what kind of reports

you have generated? or Name few Report Procedures ?

38. What is Freq Procedure? How many types of Freq procedures are there?

39. What is the default report result of One Way Freq Procedure? Can you define few

Statements and Options in One Way Freq Procedure?

40. What is the purpose of Table, Weight, By in One Way / Two / N way Freq

procedures?

41. What is Proc Freq's default behavior for handling missing values?

42. Describe CROSSLIST option in TABLES statement?

CROSSLIST option in Tables statement in Proc Two-Way Freq converts cross

tabulation report into listing report

43. Proc Mean‟s procedure in detail?

44. What are the default statistics generated by Means Procedure?

45. By default on which variable data types the means procedure generates descriptive

statistics?

46. How to classify the data in proc means and restrict on specific numeric variables to

print descriptive statistics?

47. How to override the default statistics in proc means? How to Store the results into

output dataset?

All of the variables in a summary report must be defined

as Group, Analysis, Across, or Computed variables.

48. What is the purpose of Display /Analysis / Flow / Spacing = option / Split = „spl

char‟ / Headline / Headskip / Dol,Dul,Ol, Ul / summarize / rbreak after/before /

break after/before / column statement / define statement / Across in Proc Report ?

49. What is Means Procedure ? What is the default report of Means Proc?

50. What are the default statistics of Means Procedure?

51. How to overwrite the default statistics in Means Procedure with the User defined

Statistics?

52. How to create output dataset from Means Procedure?

53. What is Maxdecd= value in proc means?

54. How does Means Procedure handle missing values?

55. What is Nobs / N / Missing options in proc means?

56. When creating an output dataset from Means Procedure it generates _Type_ /

_Freq_ ? Can you explain what does this mean?

57. Why do we use NWAY option in proc means?

58. What is the difference between Means / Summary / Univariate Procedures?

59. Is there any restriction on number of variables to be considered on Var Statement

and Table statement in Means Procedure?

Page 6: Base Sas Interview Questions by Topic

Flat No: 212, 2nd floor, Annapurna Block, Aditya Enclave, Ameerpet, Hyderabad-16. E-mail: [email protected] Tel: +9140 6462 6789, +91 998 570 6789

Online and Classroom Trainings for SAS, SAS BI

60. When do we use Proc Tabulate ? Features of Tabulate Procedure ?

61. What is Class / Var / Table statement in Proc Tabulate?

62. Can numeric variables be specified on Class statement in Proc Tabulate?

63. Write the table definition with table structure in proc tabulate?

64. What is Report Procedure? Purpose? How do you enhance each and every variable

in the output result in Report Procedure?

65. Define the options on Proc Report that you know?

66. What is Order / Across / Group usage in Proc Report?

67. What is the difference between Order and Group variable in proc report?

Order Statement generates listing report with detailed rows and sorting in

ascending order by default and suppressing the repetitive printing of the values

Group Statement generates summary report

68. In Proc Report give some ways by which you can define the variables to produce

the summary report?

69. Give some example where PROC REPORT‟s defaults are different than PROC

PRINT‟s defaults?

No Record Numbers in Proc Report

Labels (not var names) used as headers in Proc Report

REPORT needs NOWINDOWS option

70. Give some example where PROC REPORT‟s defaults are same as PROC

PRINT‟s defaults?

Variables/Columns in position order.

Rows ordered as they appear in data set.

71. Do you prefer PROC REPORT or PROC TABULATE? Why?

72. Purpose of ID / BY statement in proc Transpose? Pre-requisite for By statement in

proc transpose?

73. How would you code the criteria to restrict the output to be produced?

Use NoPrint Option

74. How to read raw data files?

75. Identify statements whose placement in the DATA step is critical.

Data, Run statements

76. What is a method for assigning first.VAR and last.VAR to the BY group variable

on unsorted data?

First. And Last. Cannot be used on Unsorted Data

77. What is the Program Data Vector (PDV)? What are its functions?

78. How would you determine the number of missing or nonmissing values in

computations?

Page 7: Base Sas Interview Questions by Topic

Flat No: 212, 2nd floor, Annapurna Block, Aditya Enclave, Ameerpet, Hyderabad-16. E-mail: [email protected] Tel: +9140 6462 6789, +91 998 570 6789

Online and Classroom Trainings for SAS, SAS BI

79. What is _n_?

Every data step that is executed creates _N_ automatic variable. Each time the data

step loops past the DATA statement, _N_ is incremented by 1. Therefore the value

of _N_ represents the number of times that the DATA step iterated.

Note: _N_ is added to the PDV, but it is not output.

80. SCAN vs. SUBSTR function?

81. What system option determines whether the macro facility searches a specific

catalog for a stored, compiled macro?

82. Do you know about the SAS autoexec file? What is its significance?

83. I want to make a quick backup of a data sets along with any associated indexes

What procedure can I use?

84. What does the statement 'format _all_;' do?

85. Can a FORMAT, LABEL, DROP, KEEP, or LENGTH statements use array

References ?

86. What is the one statement to set the criteria of data that can be coded in any step?

Options Statement

87. What is the effect of the OPTIONS statement ERRORS=1?

88. What's the difference between VAR A1 - A4 and VAR A1 -- A4?

A1- A4 ( Named Range Lists ) - Specifies all variables from a1 to a4 inclusive.

You can begin with any number and end with any number as long as you do not

violate the rules for user-supplied variable names and the numbers are consecutive.

A1 -- A4 - Specifies all the variables from a1 to a4 inclusive

89. What do the SAS log messages "numeric values have been converted to character"

mean? What are the implications?

90. Why is a STOP statement needed for the POINT= option on a SET statement?

Because POINT= reads only the specified observations, SAS cannot detect an end-

of-file condition as it would if the file were being read sequentially

91. How do you control the number of observations and/or variables read or written?

FIRSTOBS and OBS / DROP or KEEP

92. Approximately what date is represented by the SAS date value of 730?

93. Does SAS 'Translate' (compile) or does it 'Interpret'? Explain.

A typical SAS program could contain DATA steps, PROC steps and macros.

Macros are preprocessed.

DATA steps are just in time compiled.

PROC steps are interpreted in the order they appear in program.

So when we submit a SAS program consisting of all these three components, the

macro is compiled and executed first.

If a DATA step is encountered, then it is compiled and executed. Note that the

DATA step will not be executed if there is an error in the compilation.

Page 8: Base Sas Interview Questions by Topic

Flat No: 212, 2nd floor, Annapurna Block, Aditya Enclave, Ameerpet, Hyderabad-16. E-mail: [email protected] Tel: +9140 6462 6789, +91 998 570 6789

Online and Classroom Trainings for SAS, SAS BI

If a PROC step is encountered, it is interpreted and executed line by line

94. At Compile Time when a SAS dataset is read, what items are created?

Input Buffer, PDV, Descriptor Information

95. What does the RUN statement do?

When SAS editor looks at Run it starts compiling the data or proc step, if you have

more than one data step or proc step or if you have a proc step Following the data

step then you can avoid the usage of the run statement

96. What are some good SAS programming practices for processing very large data

sets?

97. What is the different between functions and PROCs that calculate the same simple

descriptive statistics?

For example Functions will give an Sum / Avg / Min / Max across an observation

Procedures will give an Sum / Avg / Min / Max across many

Observations

Functions Summarizes across Observations

Procedures summarizes across Variables

98. If you were told to create many records from one record, show how you would do

this using arrays and with PROC TRANSPOSE?

I would use TRANSPOSE if the variables are less use arrays if the var are more

99. What is a method for assigning first.VAR and last.VAR to the BY groupvariable

on unsorted data?

100. How do you debug and test your SAS programs?

First thing is look into Log for errors or warning or NOTE in somecases or use the

debugger in SAS data step Or

Print PUT Statement and DEBUG option is used for dubug and test the programs

101. What other SAS features do you use for error trapping and data validation?

Error Trapping – Log Window

Data Validation – Proc Freq , Proc Means, Proc Tabulate etc.

102. How would you combine 3 or more tables with different structures?

Sort them with common key variables and use merge statement. If the key variable

names are varying then rename the variables as per requirement .

103. Describe 5 ways to do a "table lookup" in SAS.

Match Merging, Format Table, Arrays, Proc Sql, Direct Access

104. What are some problems you might encounter in processing missing values? In

Data steps? Arithmetic? Comparisons? Functions? Classifying data?

Page 9: Base Sas Interview Questions by Topic

Flat No: 212, 2nd floor, Annapurna Block, Aditya Enclave, Ameerpet, Hyderabad-16. E-mail: [email protected] Tel: +9140 6462 6789, +91 998 570 6789

Online and Classroom Trainings for SAS, SAS BI

The result of any operation with missing value will result in missing value. Most

sas statistical procedures exclude observations with any missing values from an

analysis

105. How would you create a data set with 1 observation and 30 variables from a data

set with 30 observations and 1 variable?

Proc Transpose

106. What are _numeric_ and _character_ and what do they do?

Selects all numeric or character variable. It can be used in drop or keep dataset

options/statements or Variable Range Lists

107. How would you create multiple observations from a single observation?

Using Double Trailing @@

108. For what purpose would you use the RETAIN statement?

109. How could you generate test data with no input data?

Using Data _Null_ and Put statement

110. What can you learn from the SAS log when debugging?

It will display the execution of whole program and the logic.

111. What is the purpose of _error_?

During program execution if data errors exist then sas prints a message to the log

window and sets the automatic temporary variable _error_ to 1 for the Current

Observation

112. How does SAS handle missing values in: assignment statements, functions, a

merge, an update, sort order, formats, PROCs?

Assignment Statement – treat as zero value

Functions – ignores missing values for some statistical functions and

mathematical functions or treat it as zero(sum func)

Sort Order – treats missing as secord smallest followed by underscore

Format – Ignore missing values

Report Procedures – ignores missing values with observations and consider non

missing value for calculation

113. How do you test for missing values?

By using IF or WHERE conditions

NMISS option is used for missing values

114. How are numeric and character missing values represented internally?

Characters as Blank and Numeric as period (.)

115. Which date functions advances a date time or date/time value by a given interval?

INTNX function

Page 10: Base Sas Interview Questions by Topic

Flat No: 212, 2nd floor, Annapurna Block, Aditya Enclave, Ameerpet, Hyderabad-16. E-mail: [email protected] Tel: +9140 6462 6789, +91 998 570 6789

Online and Classroom Trainings for SAS, SAS BI

116. In the flow of DATA step processing, what is the first action in a typical DATA

Step?

117. What are SAS/ACCESS and SAS/CONNECT?

SAS/Access only process through the databases like Oracle, SQL-server, Ms-

Access etc. SAS/Connect only use Server connection

118. What is the difference between calculating the 'mean' using the mean function and

PROC MEANS?

119. I want to save hard drive space. How do I write a code to delete some or all

temporary files once I do not need them any more?

Delete some temporary files from "Work" library:

proc datasets library=work memtype=data;

delete test1 test2;

*deletes datasets test1 & test2 and keeps the rest;

quit;

120. What is a problem with merging two data sets that have variables with the

same name but different data?

121. I am using a very huge data set in SAS for windows. How do I minimize space

requirements?

1.Split huge data set into smaller data sets.

2. Clean up your working space as much as possible at each step.

3. Use dataset options (keep= , drop=) or statement (keep, drop) to limit to only the

variables needed.

4. Use IF statement or OBS = to limit the number of observations.

5. Use WHERE= or WHERE or index to optimize the WHERE expression to limit

the number of observations in a Proc Step and Data Step.

6. Use length to limit the bytes of variables.

7. Use _null_ dataset name when you don't need to create a dataset.

9. Use SQL to do merge, summary, sort etc. rather than a combination of Proc Step

and Data Step with temporary datasets.

122. Which data set is the controlling data set in the MERGE statement?

123. How do the IN= variables improve the capability of a MERGE?

124. Given an unsorted dataset, how to read the last observation to a new data

set?

End= data set option. By creating End Of File Indicator on input dataset.

For example:

data work.calculus;

set work.comp end=last;

If last;

run;

Page 11: Base Sas Interview Questions by Topic

Flat No: 212, 2nd floor, Annapurna Block, Aditya Enclave, Ameerpet, Hyderabad-16. E-mail: [email protected] Tel: +9140 6462 6789, +91 998 570 6789

Online and Classroom Trainings for SAS, SAS BI

125. Give some example where PROC REPORT’s defaults are same as PROC

PRINT’s defaults?

Variables/Columns in position order (var/column statement).

Rows ordered as they appear in data set (no sorting of rows)

126. Code the table's statement for a single level frequency?

127. What is Enterprise Guide? What is the use of it?

128. How would you code a merge that will keep only the observations that have

matches from both data sets? (IN = dataset option on MERGE statement)

129. What are input dataset and output dataset options?

130. Difference b/w sum function and using “+” operator?

SUM function returns the sum of non-missing arguments whereas “+” operator

returns a missing value if any of the arguments are missing.

131. How can u create zero observation dataset? ( OBS = 0)

132. What would be the result if all the arguments in SUM function are missing?

A missing value

133. What is SAS GRAPH?

134. Why is SAS considered self-documenting?

SAS is considered self documenting because during the compilation time it creates

and stores all the information about the data set like the time and date of the data

set creation later No. of the variables later labels all that kind of info inside the

dataset and you can look at that info using proc contents procedure

135. What has been your most common programming mistake?

I remember Missing semicolon and not checking log after submitting program,

Not using debugging techniques are my common programming errors I made

when I started learning SAS and in my initial projects.

136. Name several ways to achieve efficiency in your program. Explain trade-offs.

Efficiency and performance strategies can be classified into 5different areas.·

- CPU time

- Data Storage

Efficiency improving techniques:

- Using KEEP and DROP statements to retain necessary variables.

- Use macros for reducing the code.

- Using IF-THEN/ELSE statements to process data programming.

137. What is the significance of the „OF‟ in X = SUM (OF a1-a4,a6, a9);

138. What do the INPUT and PUT Functions do?

139. Give an example where SAS fails to convert character value to numeric value

automatically?

Suppose value of a variable Salary begins with a dollar sign ($). When

SAS tries to automatically convert the values of Salary to numeric

Page 12: Base Sas Interview Questions by Topic

Flat No: 212, 2nd floor, Annapurna Block, Aditya Enclave, Ameerpet, Hyderabad-16. E-mail: [email protected] Tel: +9140 6462 6789, +91 998 570 6789

Online and Classroom Trainings for SAS, SAS BI

values, the dollar sign blocks the process. The values cannot be converted

to numeric values.

140. What would be the resulting numeric value (generated by automatic char

to numeric conversion) of a below mentioned character value when used

in arithmetic calculation? 1,735.00

A missing value

141. Which SAS statement does not perform automatic conversions in

comparisons?

Where Statement

142. Name few SAS functions?

The interviewer frequently ask this question to test which SAS functions you are

going to specify and ask questions based on your answer. Be prepared with all the

functions.

Define each and every function with syntax and its objective

143. What date time functions come under numeric functions?

SAS stores date and time values as STANDARD NUMERIC VALUES i.e. the

Number of Days Difference between the Base Sas Date Vlaue (01Jan1960) and the

Specified date. Since the years / weeks / days / qtrs difference between two date

values cannot be calculated on character value we convert to numeric value and

apply date time numeric functions

144. Difference between SCAN and SUBSTR function?

145. What are the parameters of Scan function?

Scan (argument, n, delimiters)

argument specifies the character variable or expression to scan

n specifies which word to read

delimiters are special characters that must be enclosed in single quotation

marks

146. What is the length assigned to the target variable by the scan function?

200 bytes by default for SCAN function, the length can be changed by specifying

LENGTH statement

147. Difference between SAS Functions and Procedures?

Functions expect argument value to be supplied across an observation in a SAS

data set and procedure expects one variable value per observation.

For example:

data average ;

set temp ;

Page 13: Base Sas Interview Questions by Topic

Flat No: 212, 2nd floor, Annapurna Block, Aditya Enclave, Ameerpet, Hyderabad-16. E-mail: [email protected] Tel: +9140 6462 6789, +91 998 570 6789

Online and Classroom Trainings for SAS, SAS BI

avgtemp = mean( of T1 – T24 ) ;

run ;

Here arguments of mean function are taken across an observation.

proc sort ;

by month ;

run ;

proc means ;

by month ;

var avgtemp ;

run ;

Proc means is used to calculate average temperature by month (taking one variable

value across an observation).

148. What would be the result of following SAS function (given that 31 Dec, 2000 is

Sunday) ?

Weeks = intck („week‟,‟31 dec 2000′d,‟01jan2001′d);

Years = intck („year‟,‟31 dec 2000′d,‟01jan2001′d);

149. How do you use the do loop if you don‟t know how many times should you

execute the do loop?

Do Until or Do While to specify the condition and stop the loop conditionally

data work;

do i=1 to 20 until(Sum>=20000);

Year+1;

Sum+2000;

Sum+Sum*.10;

end;

run;

150. Have you ever linked SAS code? If so, describe the link and any required

statements used to either process the code or the step itself?

151. What statement you code to tell SAS that it is to write to an external file? What

statement do you code to write the record to the file?

FILE and PUT Statements

Sas Sql Interview Questions

152. Define different functions which can accomplish with proc sql

153. What is The SQL Procedure Pass-Through Facility?

154. Name four set operators?

155. What is the COALESCE function?

156. State some differences between the DATA Step and SQL?

157. What is the use of Proc SQL?

Page 14: Base Sas Interview Questions by Topic

Flat No: 212, 2nd floor, Annapurna Block, Aditya Enclave, Ameerpet, Hyderabad-16. E-mail: [email protected] Tel: +9140 6462 6789, +91 998 570 6789

Online and Classroom Trainings for SAS, SAS BI

SAS MACRO Interview Questions 1. What do you code to create a macro?

2. Have you used macros? For what purpose you have used?

3. How would you invoke a macro?

4. How we can create macro variable?

5. Describe the ways in which you can create macro variables?

6. How can you create a macro variable with in data step?

7. How would you identify a macro variable?

8. How would you define the end of a macro?

9. If you use a SYMPUT in a DATA step, when and where can you use the macro

variable?

10. What is the difference between %PUT and SYMBOLGEN?

11. Can you execute a macro within a macro? Describe.

12. Can you execute macro within another macro? If so, how would SAS know where

the current macro ended and the new one began?

13. How are parameters passed to a macro? OR Tell me more about the parameters in

macro?

14. How would you code a macro statement to produce information on the SAS log?

15. Tell me about call symput?

16. When we can use call symputx and why?

17. If you use a SYMPUT in a DATA step, when and where can you use the macro

variable?

18. Tell me about % include and % eval?

19. What is the maximum length of the macro variable?

20. Automatic variables for macro?

21. What system options would you use to help debug a macro?

MEMRPT: Specifies that memory usage statistics be displayed on the SAS Log.

MERROR: SAS will issue warning if we invoke a macro that SAS didn‟t find.

Presents Warning Messages when there are misspellings or when an undefined

macro is called.

SERROR: SAS will issue warning if we use a macro variable that SAS can‟t find.

MLOGIC: SAS prints details about the execution of the macros in the log.

MPRINT: Displays SAS statements generated by macro execution are traced on

the SAS Log for debugging purposes.

SYMBOLGEN: SAS prints the value of macro variables in log and also displays

text from expanding macro variables to the SAS Log.

22. What are SYMGET and SYMPUT?

23. What are the macros you have used in your programs?

24. What is auto call macro and how to create a auto call macro? What is the use of

it? How to use it in SAS with macros?

25. SAS Enables the user to call macros that have been stored as SAS programs.

The auto call macro facility allows users to access the same macro code from

multiple SAS programs. Rather than having the same macro code for in each

program where the code is required, with an autocall macro, the code is in one

Page 15: Base Sas Interview Questions by Topic

Flat No: 212, 2nd floor, Annapurna Block, Aditya Enclave, Ameerpet, Hyderabad-16. E-mail: [email protected] Tel: +9140 6462 6789, +91 998 570 6789

Online and Classroom Trainings for SAS, SAS BI

location. This permits faster updates and better consistency across all the

programs.Macro set-up:The fist step is to set-up a program that contains a

macro, desired to be used in multiple programs. Although the program may

contain other macros and/or open code, it is advised to include only one

macro.

Set MAUTOSOURSE and SASAUTOS:

Before one can use the autocall macro within a SAS program, The

MAUTOSOURSE option must be set open and the SASAUTOS option should be

assigned. The MAUTOSOURSE option indicates to SAS that the autocall facility

is to be activated. The SASAUTOS option tells SAS where to look for the

macros.

For ex: sasauto=‟g:\busmeas\internal\macro\‟;

26. Why and How to Use %PUT Statement:

27. Mention the macro functions?

28. What is the difference between %LOCAL and %GLOBAL?

29. How would you code a macro statement to produce information on the SAS log?

30. What does %put do?

31. Give example of macro quoting functions?

32. What is a sas catalog?

Sas Clinical Interview Questions:

http://saskingdom.blogspot.in/2012/02/sas-clinical-questions-with-answers.html