Let's extend by looking up a unit price as well as a product description,then multiplying the price by the quantity ordered to obtain a value for TOTAL.First,include PRICE (a numeric variable) in the PARTS data set:
The program to look up the part description and price is shown next:
ExamplePROC SORT DATA=INVOICE;
Output from the PROC PRINT is shown next:
Output from Example-Looking Up Two Variables (Method 1 - Merging)
The first step in this example, as it was in , is to sort the INVOICE data set by PART_NO.(Remember that the PARTS data set was previously sorted.)As was done before,the IN= option is used to output only those observations in the merged data set for which an INVOICE is written and missing values for PARTNAME are replaced with the text NOT ENTERED.
The total price (TOTAL) for each item is simply QUANTITY times (unit)PRICE.Finally, the DOLLAR6.2 format is applied to TOTAL so that it prints with dollar signs and commas.Since part number 999 made by the TOPHAT company is not in the PARTS data set,there is a missing value for PRICE,and therefore for TOTAL as well.
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.