SAS Questions and Answers 

·

·

1. What is SAS? 
Answer: 
SAS (Statistical Analysis System) is a powerful software suite used for advanced analytics, business intelligence, data management, and predictive analysis. 

2. What are the components of a SAS program? 
Answer: 
A SAS program typically includes: 

  • DATA step – for data manipulation 
  • PROC step – for analysis or reporting 

3. How do you import data in SAS? 
Answer: 
You can use PROC IMPORT for external files like CSV/Excel: 

PROC IMPORT DATAFILE=’data.csv’ OUT=work.dataset DBMS=CSV REPLACE;   

RUN; 

4. What is the difference between PROC MEANS and PROC SUMMARY? 
Answer: 
Both provide descriptive statistics, but PROC SUMMARY does not produce printed output by default—it requires a PRINT statement or OUTPUT OUT= dataset. 

5. What is a LIBNAME statement in SAS? 
Answer: 
LIBNAME assigns a library reference to a data storage location: 

LIBNAME mylib ‘C:\\data\\’; 

6. How does SAS handle missing values? 
Answer: 
SAS treats missing numeric values as . and character missing values as a blank ” “. They can be filtered using conditions like IF var = . THEN … 

7. What is PROC SQL in SAS? 
Answer: 
PROC SQL allows you to write SQL queries inside SAS to manipulate and retrieve data using standard SQL syntax. 

8. What are informats and formats in SAS? 
Answer: 

  • Informats tell SAS how to read data (e.g., dates). 
  • Formats tell SAS how to display data

9. What is the difference between MERGE and JOIN in SAS? 
Answer: 

  • MERGE is used in DATA step for combining datasets by a common variable. 
  • JOIN is used in PROC SQL to join datasets like in SQL. 

10. Can you perform macros in SAS? 
Answer: 
Yes, SAS supports macros for code automation and reuse. Example: 

%MACRO printdata(ds);   

PROC PRINT DATA=&ds;   

RUN;   

%MEND;   

%printdata(sashelp.class) 



Leave a Reply

Your email address will not be published. Required fields are marked *