본문 바로가기

SAS/Scenario

(16)
작업형 코드정리 (Senario)
Scenario 10 Open the ehs02 program from EHS folder and correct the errors in the program below. What is the number of observations where the variable Type is Sedan? How many observations are printed to the report titled, "Car With Average MPG Over 40" ? Example Code2 ehs02 Program : Fix the Errors [사용 코드] data work.mycars; set sashelp.cars; AvgMPG=mean(mpg_city, mpg_highway); run; title "Cars with Average M..
Scenario 9 This scenario uses the Cert.Empdata, Cert.Empdatu, and Cert.Empdatu2 data sets. Write a SAS program to do the following: Concatenate Cert.Empdata, Cert.Empdatu, and Cert.Empdatu2 to create Work.FlightEmpData. Create a macro variable named &Location and set the value for Country is the value of the macro variable. Include only the observation whose value for Country is the value of the macro vari..
Scenario 8 This scenario uses the Cert.Addresses data set. Write a SAS program to do the following: Create a temporary SAS data set that uses Cert.Addresses and store the results in Work.Scenario8. Extract the 5-digit ZIP codes from the State variable and store them in the ZipCode variable. Extract the two letters from the State variable and store them in the State variable. Create a one-way frequency tabl..
Scenario 7 This scenario uses the Cert.Temp18 data set. Write a SAS program to do the following: Create a temporary SAS data set that uses Cert.Temp18 and store the results as Work.Scenario7. Format the Day variable so that the date appears as 01JAN2018. Use a function to create a variable named Month that is equal to the numeric value of the month of the Day variable. For example, if the month is January,..
Scenario 6 This scenario uses the Excel file hear.xlsx. Write a SAS program to do the following and store the results in data set Work.Heart. Import the Excel file heart.xslx. Drop the AgeAtDeath and DearthCause variables from the Work.Heart data set. Include only the ovservations where Status=Alive in the Work.Heart data set. If the AgeCHDdiag variable has a missing value(.), then do not include the value..
Scenario 5 Open the ehs01 program from the EHS folder and correct the errors in the program. For instructions, see the commented code in the program that is marked by a slash(/) and an asterisk(*). Example Code1 ehs01 Program : Fix the Errors data work.aprilbills drop=Total, EquipCost; set cort.aprbills; if Days > 7 then Discount=(RoomCharge) * 20% else 0; TotalDue=Total - Discount; format DateIn DateOut d..
Scenario 4 This scenario uses the Cert.Laguardia data set. Write a SAS program to do the following: Print the data set Cert.Laguardia sorted and grouped by Dest. Save sour sorted data set as a temporary data set, Work.Laguardia. Store the results, grouped by the variable Dest, in a PDF file named "LGA Airport.pdf" using the FestivalPrinter style with a report title, "Laguardia Flights". [사용 코드] libname cer..