Practical No 6 A082
Practical No 6 A082
6
Aim: To create reports from excel files, read and customize SAS data sets
Prerequisite:
Assignment 1:
Write a DATA step to create a new data set named work.assistant. use the data set
orion.au_salesforce as input.
The work.assistant data set should contain observations where gender is Female
Create a new variable New_salary which is Salary +Salary multiplied by 0.10
Add the following permanent labels:
New_Salary: New Annual Salary
Salary: Employee Annual Salary
Add permanent format to display new_salary using dollar 10.2 format
Work.assistant should contain only employee_id,gender, Salary, New_salary and job_title.
run;
data work.assistant;
set oriona2.au_salesforce;
where Gender='F';
New_Salary= Salary+Salary*0.10;
run;
run;
Add PROC CONTENTS to display the descriptor portion of the data set.
Code of the program:
data work.delays;
set orion.orders;
order_month=month(order_date);
where Delivery_date>order_date+4;
Delivery_Date='Date Delivered';
run;
run;
run;
options validvarname=any;
Write a LIBNAME statement after the OPTIONS statement to create a libref named custfm that
references the excel workbook custfm_N.xlsx. (use xlsx as the engine). Display the worksheets
in the libref created.
Create a data set named subsetFemale using Data step by reading from the ‘Female’ worksheet
of the custfm_N file. The data set should contain only records with country being ‘US’ and
customer type to have only ‘Orion club Gold members’.
Add a KEEP statement to include only First_name, Last-name and Birth_Date in the new data
set.
Add a FORMAT statement in the DATA step to display Birth_date as a four-digit year
Add a LABEL statement in the DATA step to display Birth year instead of Birth_Date and
FName instead of First_Name and Lname instead of Last_name
Add a LIBNAME statement to the program to clear the libref.
Code:
data work.subsetFemale;
set custfm.females;
run;
run;
******************************