Question 1

You have a dataset named 'SALES' with columns 'REGION', 'PRODUCT', and 'AMOUNT'. You want to create a new dataset named 'HIGH SALES' containing only the records where 'AMOUNT is greater than 1000, and only the 'REGION' and 'PRODUCT' columns should be included. Which SAS code snippet would correctly achieve this?
  • Question 2

    You have a dataset with a variable 'AMOUNT' containing numeric values with decimals. You need to create a new variable 'ROUNDED AMOUNT' by rounding the 'AMOUNT' values to the nearest hundredth using the ROUND function. Which code snippet achieves this correctly?
  • Question 3

    You have a dataset with a variable 'DATE STR' storing dates in the format 'YYYY-MM-DD'. You want to create a new variable 'DATE NUM' storing the date in numeric format (YYYYMMDD). Which code snippet correctly achieves this transformation?
  • Question 4

    You have a dataset 'EMPLOYEES' with 'ID', 'NAME', 'SALARY', and 'DEPARTMENT' variables. You need to create a new dataset 'HIGH SALARY DEPT' containing only employees who have a salary higher than the average salary of their respective department. Which combination of statements would achieve this?
  • Question 5

    You have a dataset with customer purchase records, including their customer ID, purchase date, and purchase amount. You want to calculate the average purchase amount for each customer but only for the purchases made in the last three months. Using the DATA step, how would you modify the code to achieve this, taking advantage of BY group processing with FIRST. and LAST. variables?