0% found this document useful (0 votes)
4 views

let path

The document outlines a series of SAS procedures for importing, cleaning, and analyzing TSA claims data from 2002 to 2017. It includes steps for removing duplicates, cleaning specific columns, and generating frequency tables and statistics for claims by year and by state. The final output is formatted as a PDF report containing detailed claim type, site, and disposition frequencies for a specified state.

Uploaded by

rana.ahmed
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

let path

The document outlines a series of SAS procedures for importing, cleaning, and analyzing TSA claims data from 2002 to 2017. It includes steps for removing duplicates, cleaning specific columns, and generating frequency tables and statistics for claims by year and by state. The final output is formatted as a PDF report containing detailed claim type, site, and disposition frequencies for a specified state.

Uploaded by

rana.ahmed
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

%let path=/home/u63390619/TSA project/TSAClaims2002_2017.

csv;
libname tsa "/home/u63390619/TSA project";
options validvarname=v7;
proc import datafile="/home/u63390619/TSA project/TSAClaims2002_2017.csv"
dbms=csv
out=tsa.ClaimsImport
replace;
guessingrows=max;
run;

data tsa.claims_cleaned;
set tsa.Claims_NoDups;
run;

proc print data=tsa.ClaimsImport (obs=20);


run;
proc contents data=tsa.ClaimsImport varnum;
run;
/*******/
proc sort data=tsa.ClaimsImport
out=tsa.Claims_NoDups
nodupkey;
by _all_;
run;
/****Remove duplicate rows*****/
proc sort data=tsa.Claims_NoDups;
by Incident_Date;
run;
/**Sort the data by ascending Incident_Date.****/

data tsa.Claims_NoDups;
set tsa.Claims_NoDups;
if missing(Claim_Site) or Claim_Site = "-" then Claim_Site = "Unknown";
run;
/****Clean the Claim_Site column.*****/
data tsa.Claims_NoDups;
set tsa.Claims_NoDups;
if missing(Claim_Type) or Claim_Type = "-" then Claim_Type = "Unknown";
run;
data tsa.Claims_NoDups;
set tsa.Claims_NoDups;
if Claim_Type = "Passenger Property Loss/Injury" then Claim_Type = "Passenger Property
Loss";
run;
data tsa.Claims_NoDups;
set tsa.Claims_NoDups;
if Claim_Type = "Property Damage/Personal Injury" then Claim_Type = "Property Damage";
run;
/***************Clean the Claim_Type column.********************/
data tsa.Claims_NoDups;
set tsa.Claims_NoDups;
if missing(Disposition) or Disposition = "-" then Disposition = "Unknown";
run;

data tsa.Claims_NoDups;
set tsa.Claims_NoDups;
if Disposition='Closed: Canceled' then Disposition='Closed:Canceled';
run;

data tsa.Claims_NoDups;
set tsa.Claims_NoDups;
if Disposition= "losed: Contractor Claim." then Claim_Type = "Closed:Contractor Claim";
run;
/***************Clean the Disposition column.********************/
data tsa.Claims_NoDups;
set tsa.Claims_NoDups;
State=upcase(state);
StateName=propcase(StateName);
run;
/***************Convert all State values to uppercase and all StateName values to proper
case.********************/
data tsa.Claims_NoDups;
set tsa.Claims_NoDups;
if (Incident_Date > Date_Received or
Incident_Date = . or
Date_Received = . or
year(Incident_Date) < 2002 or
year(Incident_Date) > 2017 or
year(Date_Received) < 2002 or
year(Date_Received) > 2017) then Date_Issues="Needs Review";
run;
/***************create a new column that indicates date issues.********************/
data tsa.Claims_NoDups;
set tsa.Claims_NoDups;
format Incident_Date Date_Received date9. Close_Amount Dollar20.2;
label Airport_Code="Airport Code"
Airport_Name="Airport Name"
Claim_Number="Claim Number"
Claim_Site="Claim Site"
Claim_Type="Claim Type"
Close_Amount="Close Amount"
Date_Issues="Date Issues"
Date_Received="Date Received". Add permanent labels and formats.
Incident_Date="Incident Date"
Item_Category="Item Category";
run;
/***************Add permanent labels and formats.********************/
data tsa.Claims_NoDups;
set tsa.Claims_NoDups;
drop County City;
run;
/***************Drop County and City.********************/
data tsa.claims_cleaned;
set tsa.Claims_NoDups;
run;
/***************----------------********************/
title "Overall Date Issues in the Data";
proc freq data=TSA.Claims_Cleaned;
table Date_Issues / nocum nopercent;
run;
title;
ods graphics on;
title "Overall Claims by Year";
proc freq data=TSA.Claims_Cleaned;
table Incident_Date / nocum nopercent plots=freqplot;
format Incident_Date year4.;
where Date_Issues is null;
run;
title;
/***************----------------********************/
%let outpath=/home/u63390619/TSA project;
/* Set the output format to PDF */
ods pdf file="&outpath/ClaimReports.pdf" style=Meadow;

%let StateName=California;
title "&StateName Claim Types, Claim Sites and Disposition
Frequencies";
proc freq data=TSA.Claims_NoDups order=freq;
table Claim_Type Claim_Site Disposition / nocum nopercent;
where StateName="&StateName" and Date_Issues is null;
run;
title "Close_Amount Statistics for &StateName";
proc means data=TSA.Claims_NoDups mean min max sum maxdec=0;
var Close_Amount;
where StateName="&StateName" and Date_Issues is null;
run;
title;

/* Close the output destination */


ods pdf close;

You might also like