For this example you have two SAS data sets. DAILY contains subject ID number, YEAR ,SEASON, and RAINFALL;TEMP contains TEMPER (mean temperature), YEAR, and SEASON.
Here are some sample data: You want to read the DAILY data set, look up the temperature in the TEMP data set corresponding to the matching YEAR andSEASON, and create a new data set called COMBINED.Here is the code:
ExamplePROG SORT DATA=TEMP;
The resulting output is:
Output from Example - A Two-way Lookup Table
By match-merging the two data sets on the variables YEAR and SEASON, you are able to associate the mean temperature with the amount of rainfall for each year-season combination.In this example, bit's ambiguous as to which data set serves as the lookup table and which one serves as the data. Usually, a lookup table has one record for each unique value of the lookup variable.In this case, they both do.
a. a listing, sorted by ID,showing ID, the transaction number, and the total sales for each transaction.
b. a summary showing the total sales for each employee.
c. a summary showing the total company sales for each GENDER.
Here are some sample data values from each data set: Note that data set EMPLOY is already sorted in ID order and data set PARTS is already sorted in PART_NO order.Hints: Since this is a difficult problem, let us suggest a few hints.First,merge the PARTS and SALES data sets to create a new data set (call it NEWSALES) that contains ID,TRANS,and TOTAL (PRICE*QUANTITY).Notice that there are some part numbers in the PARTS file that were not sold and need not be included in the listing.This is enough for part A.
Next, merge the NEWSALES data set just created with the EMPLOY data set so that GENDER information can be added.Consider using PROC MEANS to compute totals by ID for part B,and totals by GENDER for part C.You can accept output from PROC MEANS or, if you want to be fancy,create a report from an output data set created by PROC MEANS (discussed in Chapter 10, "PROC MEANS and PROC UNIVARIATE"). We show both solutions.
Use PROC FORMAT and a PUT function as in to solve this problem.
SAS Programming Related Tutorials
|SASS (Syntactically Awesome Style sheets) Tutorial||R Programming language Tutorial|
SAS Programming Related Interview Questions
|Logistics Interview Questions||SAS Programming,SQL server Interview Questions|
|Clinical SAS Interview Questions||SASS (Syntactically Awesome Style sheets) Interview Questions|
|SQL Server Analysis Services (SSAS) Interview Questions||R Programming language Interview Questions|
|SAS DI Interview Questions||Advanced SAS Interview Questions|
|Base Sas Interview Questions||SAS Macro Interview Questions|
|Clinical Data Management Interview Questions|
Sas Programming Tutorial
Input And Infile
Set, Merge, And Update
Table Lookup Tools
Proc Means And Proc Uimivariate
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.