SASInstitute SAS Certified Associate: Programming Fundamentals Using SAS 9.4 (A00-215) Free Practice Test
Question 1
You have a dataset with variables 'Region' and 'Sales'. You want to create a new variable 'TotalSales' that accumulates the sales for each region. Which code snippet would you use in the DATA step to achieve this?
Correct Answer: A
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 2
A dataset contains a variable 'StartDate' with dates stored as SAS date values. You need to calculate the number of days between 'StartDate' and the current date, excluding weekends (Saturday and Sunday). Which code snippet correctly calculates the difference?
Correct Answer: D
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 3
You have two SAS datasets, 'SALES 2022' and 'SALES 2023', each containing sales data for the respective years. Both datasets share the same structure with variables like 'Region', 'Product', and 'SalesAmount'. You want to combine these datasets into a single dataset called 'ALL SALES' to analyze the sales trends over the two years. How would you accomplish this using the SET statement within the DATA step, ensuring that the original datasets remain untouched?
Correct Answer: B
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 4
You have a dataset named 'Employee_Data' containing employee information. You want to create a new dataset named 'High_Salary_Employees' containing only employees with a salary greater than $100,000 and working in the 'IT' department. Which code snippet correctly uses the OUTPUT statement to achieve this?
Correct Answer: E
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 5
You are analyzing a SAS dataset named 'CUSTOMER DATA' with several variables including 'CUSTOMER ID', 'NAME', 'AGE', 'CITY', and 'INCOME'. You want to create a new variable called 'INCOME GROUP based on the 'INCOME' variable, where 'INCOME GROUP is a character variable with values 'LOW', 'MEDIUM', and 'HIGH' based on income ranges. Which of the following SAS code snippets correctly defines the 'INCOME GROUP' variable with the desired character values?
Correct Answer: C
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 6
You have a CSV file named 'sales_data.csv' with the following structure: Product,Region,Sales Product A,North,1000 Product Product C,East,800 Product D,West, 1200 You need to import this data into a SAS dataset named 'SALES' with the following requirements: 1. The 'Sales' column should be converted to a numeric variable. 2. The 'Region' column should be treated as a character variable. 3. The 'Product' column should be the primary key. Which of the following PROC IMPORT statements would achieve this correctly?
Correct Answer: D
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 7
You have a dataset named 'Customer _ Data' with customer information, including their purchase history. You need to create a new dataset named 'Loyal_Customers' containing only customers who have made at least 5 purchases within the last year. Additionally, you need to retain only the CustomerlD and Total Purchases variables in the new dataset. Which code snippet correctly uses the OUTPUT statement to achieve this?
Correct Answer: E
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 8
You have a dataset 'CUSTOMERS' with variables 'CUSTOMER ID', 'NAME', 'CITY', and 'STATE'. You want to create a new dataset 'NEW CUSTOMERS' containing only observations from the 'CUSTOMERS' dataset where the 'STATE' is either 'CA' or 'NY'. You also want to add a new variable called 'REGION' to the 'NEW CUSTOMERS dataset, assigning 'West' for CA customers and 'East' for NY customers. Which of the following DATA step code snippets will achieve this?
Correct Answer: A,B
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).