


What would be the value of month at the end of data step execution and how many observations would be there?

Question: Consider the following SAS Program Question: What is the function of tranwrd function?Īnswer: TRANWRD function replaces or removes all occurrences of a pattern of characters within a Question: What is the length assigned to the target variable by the scan function?Īnswer: Scan, Substr, trim, Catx, Index, tranwrd, find, Sum. What would be the result returned by the scan function in the following cases? Question: Suppose the variable address stores the following expression:Ģ09 RADCLIFFE ROAD, CENTER CITY, NY, 92716 Question: What are the parameters of Scan function?Īrgument specifies the character variable or expression to scanĭelimiters are special characters that must be enclosed in single quotation marks Question: What would be the result of following SAS function(given that 31 Dec, 2000 is Sunday)? Put function – Numeric to character conversion- put(source,format) Question: Briefly explain Input and Put function?Īnswer: Input function – Character to numeric conversion- Input(source,informat) Question: Which SAS statement does not perform automatic conversions in comparisons? Question: 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? Question: 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? Therefore, it is always best to include INPUT and PUT functions in your programs when conversions occur. The values cannot be converted to numeric values. When SAS tries to automatically convert the values of PayRate to numeric values, the dollar sign blocks the process. Question: Give an example where SAS fails to convert character value to numeric value automatically?Īnswer: Suppose value of a variable PayRate begins with a dollar sign ($). Question: What would be the denominator value used by the mean function if two out of seven arguments are missing? Question: What would be the result if all the arguments in SUM function are missing? In the output, value of p is missing for 3rd, 4th and 5th observation as : Question: Differnce b/w sum function and using “+” operator?Īnswer: SUM function returns the sum of non-missing arguments whereas “+” operator returns a missing value if any of the arguments are missing. Proc means is used to calculate average temperature by month (taking one variable value across an observation). Here arguments of mean function are taken across an observation. Question: What is the difference between SAS function and procedures?Īnswer: Functions expects argument value to be supplied across an observation in a SAS data set and procedure expects one variable value per observation. Question : What is the difference between reading the data from external file and reading the data from existing data set?Īnswer: The main difference is that while reading an existing data set with the SET statement, SAS retains the values of the variables from one observation to the next. Last is the temporary variable (initialized to 0) which is set to 1 when the set statement reads the last observation. Where Calculus is a new data set to be created and Comp is the existing data set
7 sas interview questions and answers how to#
Question: Given an unsorted dataset, how to read the last observation to a new data set? Whereas If want to process certain variables and do not want them to appear in the new data set, then specify drop= data set option in the data statement. Question : What is the difference between using drop= data set option in data statement and set statement?Īnswer: If you don’t want to process certain variables and you do not want them to appear in the new data set, then specify drop= data set option in the set statement. Question: What is the function of Stop statement?Īnswer: Stop statement causes SAS to stop processing the current data step immediately and resume processing statement after the end of current data step. Placing an explicit OUTPUT statement in a DATA step overrides the automatic output, so that observations are added to a data set only when the explicit OUTPUT statement is executed. Question: What is the function of output statement?Īnswer: To override the default way in which the DATA step writes observations to output, you can use an OUTPUT statement in the DATA step. Questions are either asked directly or indirectly in SAS Interviews.

Thus, all answers for the below mentioned questions are correct (for your learning). NOTE: The purpose of this post is to povide a learning for those preparing for SAS interview or global certification.
