/* Case Study 2 Solutions */ /* Part 1 */ /* Compress the SalesData2000 SAS Data Set */ data SalesData2000 ( compress = char); set ia.SalesData2000; run; /* Part 2 */ /* Create a DATA step view */ data NewTicketAgents / view = NewTicketAgents; infile newagent missover pad; input @1 TicketAgentIDNumber $8. @9 AirportCode $3. @12 BranchName $50. @62 City $25. @87 State $30. @117 Country $25.; run; /* Print the data in the View */ filename newagent 'NewAgents.dat'; proc print data = NewTicketAgents; run; /* Part 3.a. */ filename newagent 'NewAgents.dat'; proc copy in=ia out=work; select ticketagents;run; proc append base = TicketAgents data = NewTicketAgents; run; /* Part 3.b. */ proc sort data = TicketAgents; by TicketAgentIDNumber; run; proc print data = TicketAgents; title1 'Current Ticket Agents'; title2 'Ordered by Ticket Agent ID Number'; run; /* Part 4 */ /* Create a report from SalesData2000 */ data sum( keep = origin destination total); set ia.SalesData2000; format total comma10.; label total = 'Total Passengers'; by Origin Destination notsorted; if first.origin and first.destination then total = 0; total + FirstClassPassengers; total + BusinessPassengers; total + EconomyPassengers; if last.destination; run; /* Print the first 20 observations */ proc print data = sum(obs = 20) label; title 'ia.SalesData2000 Data Set, First 20 Obs. '; run;