/*
Chapter 3
Question 10 : Stock Stock symbol 1 4 Char
PurDate Purchase date 5 10 mm/dd/yyyy
PurPrice Purchase price 15 6 Dollar signs and
commas
Number Number of shares 21 4 Num
SellDate Selling date 25 10 mm/dd/yyyy
SellPrice Selling price 35 6 Dollar signs and
commas
Author Name : Shruti Goyal
*/
data stocks1;
infile 'd:\sas\stockprices.txt' dsd;
input @1 Stock $4.
@5 PurDate mmddyy10.
@15 PurPrice dollar6.
@21 Number 4.
@25 SellDate mmddyy10.
@35 SellPrice dollar6.
;
TotalPur = Number * PurPrice;
TotalSell = Number * SellPrice;
Prfit = TotalSell-TotalPur;
run;
title 'Old format display';
proc print data=stocks1;
Format PurDate date9.
SellDate date6.
SellPrice dollar6.
PurPrice dollar6.
Profit dollar7.2;
run;

Like this:
Like Loading...
Related