You are on page 1of 1
1. What Is SAS? This is categorized under basic SAS interview questions SAS(Statistical Analysis System) is a combined set of software solutions that helps users to analyze data. It will be helpful in : Information retrieval and data management Writing reports and graphics Statistical analysis, econometrics, and data mining Business planning, forecasting, and decision support Operation Research and Project management Quality improvement Data warehousing Application development 2. Explain What Is Data Step? The data set creates a SAS dataset that carries the data along with a ‘data dictionary’. The data dictionary holds information about the variables and their properties. 3. Explain The Basic Structure Of SAS Programming. SAS program consists of : * DATA step, which recovers and manipulates data * PROC step, which interprets the data 4. Explain The Scan Function. Syntax: scan(argument,n,delimiters) Argument: specifies the character variable or expression to scan n: specifies which word to read delimiters: specifies special characters that must be enclosed in single quotation marks. 5. What Is The Function Of A Stop Statement? Stop statement causes SAS to stop processing the current data step immediately and resume processing after the end of the current data step. 6. Difference B/W Sum Function And Using ‘+’ Operator? SUM function returns the sum of non-missing arguments. ‘+’ operator returns a missing value if any of the arguments are missing. 7. How To Perform ‘Table Lookup’? * Match merging * Direct access * Format tables © Arrays » PROC SQL 8. Explain Data Step Processing. When we submit a Data step, SAS processes the DATA step, SAS processes the DATA step, and then creates a new SAS data set. There will be two phases: * Compilation phase * Execution phase 9. What Is The Difference Between B/W PROC Means And PROC Summary? Proc Summary Proc Means Defaults to NOPRINT Proc Means Defaults to PRINT If you omit the VAR statement, then Tries to analyze all the numeric produces a simple count of variables that are not listed in other observations statements If you omit the VAR statement, then While specifying statistics on the it analyzes all numeric variables that statement, VAR statement is omitted, are not listed in the other then it stops processing and an error statements. When all variables are message is written to the SAS. character variables it produces a simple count of observation. 10. How To Create List Output For Cross Tabulations In Proc Freq? To generate list output for cross tabulations, add a slash(/) and the LIST option to the Tables statement in your PROC FREQ step. TABLES variable-1*variable-2 <* ... variable-n> / LIST; 11. How To Debug And Test SAS Programs? Look into Log for errors or warnings or NOTE in some cases use the debugger in SAS data step. There are some system options that can be used to debug SAS Macros: MPRINT, MLOGIC, SYMBOLGEN 12. What Is The Function Of Tranwrd Function? TRANWRD function replaces or removes all occurrences of a pattern of characters within a character string. 13. What Is The Difference Between Do While And Do Until? Main difference between the DO UNTIL and DO WHILE statements is that the DO WHILE expression is evaluated at the top of the DO loop. If the expression is false the first time it is evaluated, then the DO loop never executes. But DO UNTIL executes at least once. 14. How To Achieve Efficiency In The SAS Program? Efficiency and performance strategies are classified into 5 different areas: * CPU time » Data Storage * Elapsed time © Input/Output * Memory CPU time and Elapsed time 15. Give Examples Of Efficiency Techniques. Using KEEP and DROP statements to retain necessary variables Use macros for reducing the code Use SQL procedure to reduce the number of programming steps Using IF-THEN/ELSE statements to reduce the variable size for reducing Data storage Using _NULL_ steps for processing null data sets for Data storage How To Remove Duplicates Using PROC SQL? » Proc SQL noprint; * Create table inter.Merged 1 as * Select distinct * from inter.readin; © Quit; 16. How To Remove Duplicates Using PROC SQL? Proc SQL noprints Create Table inter.Merged1 as Select distinct * from inter.readins Quit; 17. Explain CATX. CATX syntax concatenates character strings, removes trailing and leading blanks, and inserts separators. 18. Explain How You Can Debug And Test Your SAS Program? You can debug and test your SAS program by using Obs=o and systems options to trace the program execution in a log. 19. Mention The Categories In Which SAS Informatics Are Placed? SAS informants are placed in three categories : » Character informants: $INFORMATW * Numeric Informants: INFORMAT w.d * Date/Time Informants: INFORMAT w. 20. Mention The Validation Tools Used In SAS? For Dataset : Data set name/ debug Data set: Name/stmtchk For Macros: Options: imprint logic symbolgen Top SAS Interview Questions And Answers 21. Explain PROC Print And PROC Contents? PROC print: To display the contents of the SAS dataset and also to assure that the data were read into SAS correctly. PROC Contents: To display information about a SAS dataset. 23. Explain The Difference Between Nod Up Key And Nod Up Options. NODUP NODUPKEY Compares all the variables in our Compares just the BY variables dataset Removes duplicate observations Removes duplicate observations where values in all the variables are —_ where the value of a variable listed in repeated(identical observations) the BY statement is repeated 24. Explain What SAS Informants? SAS informants are used to reading, or input data from external files known as Flat Files ASCII files, text files, or sequential files. The informant will tell SAS how to read data into SAS variables. 25. How To Count Unique Values By A Grouping Variable? We can use PROC SQL with COUNT(DISTINCT variable_name) to determine the number of unique values for a column. 26. Explain Proc Glam. Proc glam performs : * Simple and multiple regression * Analysis of variance (ANOVA) » Analysis of covariance + Multivariate analysis of variance * Repeated measure analysis of variance 27. What Is A Program Data Vector(PDV)? PDV is a logical area in the memory. PDV is created followed by the creation of an input buffer. SAS builds a dataset in the PDV area of memory. 28. Explain SYMGET And SYMPUT. SYMPUT: puts the value from a dataset into a macro variable. SYMGET: gets the value from the macro variable to the dataset. 29. What Is The Difference Between SCAN And SUBSTR? SCAN: extracts words within a value that is marked by delimiters SUBSTR: extracts a portion of the value by stating the specific location 30. What Is The Difference Between Proc Means And Proc Summary? The difference between the two procedures is: Proc means: will give descriptive statistics. By default, it will give output in the output window. Proc summary: will not give output as default, we need to give an option to print then only it will give the output. 31. What Are The Key Features Of SAS? » Strong Data analysis abilities * SAS Studio * Support for various types of Data Format * Flexible 4 generation programming language (4GL) » Report output format * Data Encryption Algorithms » SAS management * Al, ML, and IoT 32. How Many Data Types Are There In SAS? Two data types are present: Character and Numeric. 33. How To Limit Decimal Places For Variables Using PROC MEANS? By using the MAXDEC= option 34. How To Specify Variables To Be Processed By The FREQ Procedure? By using TABLES Statement 35. What Is The Purpose Of Double Trailing @@ In The Input Statement? The double trailing sign (@@) tells SAS rather than advancing to a new record, hold the current input record for the execution of the next INPUT statement. 36. How To Include Or Exclude Specific Variables In A Data Set? Using DROP, KEEP Statements and Data set options. 37. What Are The Default Statistics That PROC MEANS Produce? It produces the default statistics of MIN, MAX, MEAN, and STD DEV. 38. What Is Data_NULL_? It can also be used to write output without creating a dataset. 39. How To Remove Unique And Duplicate Values? By using PROC SORT with NODUPKEY and NODUP Options. 40. How To Sort In Descending Order? Use the DESCENDING keyword in the PROC SORT code. Top SAS Interview Questions And Answers 41. How To Convert A Numeric Variable To A Character Variable? By creating a differently-named variable using the PUT function. 42. How To Convert A Character Variable To A Numeric Variable? By creating a differently-named variable using the INPUT function. 43. Explain What Is Factor Analysis? The factor analysis in SAS is used for the particular statistical methods that are basically associated with the elimination of variables, which are in terms of the factors and numbers. The main purpose of this factor analysis is to summarize and reduce the data. 44, What Is The Difference Between SET And MERGE? SET concatenates the data sets whereas MERGE matches the observations of data sets 45. Which Date Function Advances A Date, Time, Or DateTime Value By A Given Interval? INTNX function advances a date, time, or DateTime value by a given interval, and returns a date, time, or DateTime value. 46. What Is The Purpose Of Using The RETAIN Statement? A RETAIN statement tells SAS not to set variables to missing when going from the current iteration of the DATA step to the next. Instead, SAS retains the values. 47. What Is The Difference Between %EVAL And %SYSEVALF? %EVAL cannot perform arithmetic calculations with operands that have floating-point values. It is when the %SYSEVALF function comes into the picture. 48. Name A Few SAS Functions? Scan, Substr, trim, Catx, Index, tranwrd, find Sum. 49. What Is The Difference Between INPUT And INFILE? The INFILE statement is used to identify an external file while the INPUT statement is used to describe your variables. 50. Difference Between Miss Over And Truncover. When the MISS OVER option is used on the INFILE statement, the INPUT statement does not jump to the next line when reading a short line. Instead, MISS OVER sets variables to missing. 51. How To Print Observations 4 Through 8 From A Data Set? Using the FISRTOBS= and OBS=statements. 52. What SUBSTR Function Does? The SUBSTR function is used to extract a substring from a character variable. 53. What Is The Difference Between CEIL And FLOOR Functions? The CEIL function returns the smallest integer greater than/equal to the argument whereas the floor returns the greatest integer less than/equal to the argument. 54. What Is The Difference Between SCAN And SUBSTR? SCAN extracts words within a value that is marked by delimiters. SUBSTR extracts a portion of the value by stating the specific location. It is best used when we know the exact position of the substring to extract from a character value. 55. How To Save Logs In An External File? Use PROC PRINTTO 56. How Does Data Step Merge And PROC SQL Handle Many-To-Many Relationships? Data step MERGE does not create a cartesian product in case of a many-to- many relationship. Whereas, Proc SQL produces a cartesian product. 57. What Is The Smallest Length For A Numeric And Character Variable Respectively? 2 bytes and 1 byte 58. What Is The Difference Between SAS PROCs And The SAS DATA STEP. Procs are subroutines with a specific purpose in mind and the data step is designed to read in and manipulate data. 59. How Can You Write A SAS Data Set To A Comma-Delimited File? PUT(formatted) statement in a data step 60. Which SAS Statement Does Not Perform Automatic Conversions In Comparisons? where statement Top SAS Interview Questions And Answers 61. Difference Between Input And Put Function? Input function- Character to numeric conversion-Input(source,informat) and put function-Numeric to character conversion-put(source,format) 62. If A Variable Contains Letters Or Special Characters, Can It Be A Numeric Data Type? No, it must be a character data type. 63. What Can Be The Size Of The Largest Dataset In SAS? The number of observations is limited only by the computer's capacity to handle and store them. 64. What Is The Difference Between The CLASS Statement And BY Statement In Proc Means? BY processing requires that your data already be sorted or indexed in the order of the BY variables. 65. How Would You Identify A Macro Variable? With Ampersand(&) sign 66. How To Sort In Descending Order? Use the DESCENDING keyword in the PROC SORT code. The example below shows the use of the descending keyword. PROC SORT DATA = auto; By DESCENDING engine; RUN ; 67. What Would Be The Denominator Value Used By The Mean Function If Two Out Of Seven Arguments Are Missing? Five would be the denominator value 68. What Are The Two Parts Of The SAS Dataset? * Descriptive portion(contains data set properties and Variable properties) * Data portion 69. How Can You Read A Dataset That Has More Than 32 Character Long Names? Using SQL explicit pass-through facility. 70. What Will Happen To A Variable That Has A Variable Name>32 Characters Long When You Read A Dataset? Variable names will be truncated to 32 characters only. 71. How Can You Use Special Characters In A Dataset Name? By using the VALIDMEMNAME option and name literal. option validmemname-extend; data "SalaryIn$'n; salary-8005 runs 72. How Can You Access MS Excel Or MS Access Files Using The Libname Statement? Using excel engine and access engine. Example: * libname my excel “d:\employee.xisx”; « libname my access “d:\employee.mdb”; 73. Write A Program To Print Names Of All Datasets Present In Library SAS USER. There are two ways: proc contents data-sasuser._all_ nods; runs proc sql; select memname from dictionary. tables: where Libname="SASUSER”; quits 74. How Can You Read A File That Contains Special Characters In The Name Such As $? We can use name literals in SAS that tells SAS to allow that particular character in the name: Libname admin “D:\admit..x1sx"5 data MY_admission; set admit.’ admission‘n; runs 75. What Is A Logical Error And How To Identify It? A logical error is something, when a program runs it does not throw any error in the log message however produces incorrect results. You can identify logical errors using putlog or put statements that print statements in the SAS log. 76. Write A Program To Read The Last Observation Of The Dataset Sauser. Admit? data last_observation; set sasuser.admit end=x; if x; run; 77. Write A Program To Replace Missing Values For All Numeric Variables Present In The Employee Dataset To 0? options missing-0; data missing_replace; set missing_value; runs 78. What Are The Types Of SAS Statements? * Global statements: These statements can be used anywhere in the SAS program and stay in effect until changed. For example, statements used with options and title statements. * Data steps and proc step: They stay effective within the Data step and proc step. 79. What Is The Purpose Of Proc Steps? Proc steps generally analyze data and produce output, they take SAS dataset as input or other data formats. 80. A SAS DATA Step Is Processed In How Many Phases? And In Which Phase PDV And Descriptor Portions Of The Dataset Are Created? SAS data step is processed in the Compilation phase and Execution phase. The PDV and Descriptor portion is created in the Compilation phase. 81. What Is The Use Of _N_variable? The _N_automatic variable represents how many times the DATA step has iterated. 82. What Is The Use Of _Error_varaible? _Error_variable holds value 1 if the error is present in the program. 83. How To Print PDV In SAS Log? Use the PUTLOG statement to print the PDV in the SAS log example: putlog_all_; 84, Retain Statement Is Compile-Time Statement Or Execution Time Statement? Compile statement 85. What Statement Is Used To Avoid Truncating Variable Values? Length statement 86. At The Beginning Of The Execution Phase What Are The Values Of _error_and_n_variables? _Error_=0 and _N =1 87. Write A Program To Read The Employee Dataset's 5th Observation- Only, (Note: Do Not Use Fifth Obs And Obs Dataset Options)? data read_fifth_obs; set employee; if_n_=53 runs 88. Once You Have Had The Data Read Into SAS Data Sets Are You More Of A Data Step Programmer Or A Proc SQL Programmer? It depends on what type of analysis datasets are required for creating tables but Iam more of a data step programmer as it gives more flexibility. For e.g creating a change from the baseline dataset for blood pressure sometimes I have to retain certain values, use arrays or use the first and last variables. 89. What Types Of Programming Tasks Do You Use Proc SQL Versus The Data Step? Proc SQL is very convenient for performing table joins compared to a data step merge as it does not require the key columns to be sorted prior to joining. A data step is more suitable for sequential observation-by-observation processing. PROC SQL can save a great deal of time if you want to filter the variables while selecting or you can modify them by applying format creating new variables, macro variables as well as subsetting the data. PROC SQL offers great flexibility for joining tables. 90. Why And When Do You Use Proc SQL? Proc SQL is very convenient for performing table joins compared to data step merge as it does not require the key columns to be sorted prior to joining. A data step is more suitable for sequential observation-by-observation processing. PROC SQL can save a great deal of time if you want to filter the variables while selecting or we can modify them, apply format and create new variables, macro variables as well as subsetting the data. PROC SQL offers great flexibility for joining tables. 91. Do You Use Proc Report Or Proc Tabulate? Which Do You Prefer? Proc report as it is highly customizable and flexible where I can define each column in whatever way I want to and even make use of SAS functions, logic processing, and assignment statements and create new ones. Variables for report making use of the compute block of Proc report. It is a more efficient tool than tabulate because with a report we can do frequency and tabulate also. 92. How To Display Duplicate Observations In A Data Using Base SAS? There are two ways to display duplicate observations: * In the data step, use first.var and last.var * Using proc sort with option dropout option. 93. Does SAS Translate(Compile)? Or Does It Interpret? 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 the 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. If a PROC step is encountered, it is interpreted and executed line by line. 94. How Do You Validate The SAS Program? When a SAS code is submitted, SAS performs syntactical checks before executing the program/code. In that case, one of the ways could be at the beginning of the code, write OPTIONS OBS =0 in addition to other options and then RUN it. This way data will not be processed and the log shows error messages/warnings if any. If you are executing SAS code on PC SAS, the highlighted colors themselves show the syntactical errors if any. 95. When Looking For Data Contained In A Character String Of 150 Bytes, Which Function Is The Best To Locate That Data: Scan, Index, Or Index C? INDEX: Searches a character expression for a string of characters, and returns the position of the string’s first character for the first occurrence of the string. INDEX(source, excerpt) it returns the position where the 2nd field is in the source. 96. How Would You Create Multiple Observations From A Single Observation? Line pointer is used for multiple lines per observation, @@ is used for multiple observations per line. 97. What Are Some Good SAS Programming Practices For Processing Very Large Data Sets? Arrays are used for processing large datasets. 98. Why Is SAS Considered Self-Documenting? When a data set is created SAS creates a descriptor portion that means SAS stores the information like a variable name, length, type, etc. 99. Have You Ever Used Proc SQL For Data Stigmatization? Yes for summarization at times. For eg: if I have to calculate the max value of BP for patients 101 102 and 103 then I use the max(BPD) function to get the maximum value and use group by a statement to group the patients accordingly. 100. Tell Me About Your SQL Experience? SAS/ACCESS SQL pass-thru facility for connection with external databases and importing tables from them and also Microsoft access and excel files. Besides this, PROC SQL for joining tables. These SAS interview questions and answers are designed for freshers as well as experienced data analysts. Tricky SAS interview questions include all three difficulty levels. Interviewers ask candidates these SAS interview questions to check their technical knowledge.

You might also like