I'm having a problem with my program in SAS running properly. There's something wrong with the way I'm acquiring data from my file and it's messing up everything inside. Here is the portion of my code messing up:
data Stocks;
infile 'location of file.txt';
input @1 Stock : $4.
@5 PurDate : mmddyy10.
@15 PurPrice : dollar6.1
@21 Number : 4
@25 SellDate : mmddyy10.
@35 SellPrice : dollar6.1;
TotalPur = Number * PurPrice;
TotalSell = Number * SellPrice;
Profit = TotalSell - TotalPur;
run;
proc print data=Stocks;
var Stock PurDate PurPrice Number SellDate SellPrice TotalPur TotalSell Profit;
run;
And here is the data I'm working with:
IBM 5/21/2006 $80.0 10007/20/2006 $88.5
CSCO04/05/2005 $17.5 20009/21/2005 $23.6
MOT 03/01/2004 $14.7 50010/10/2006 $19.9
XMSR04/15/2006 $28.4 20004/15/2006 $12.7
BBY 02/15/2005 $45.2 10009/09/2006 $56.8
The data description is as follows:
Stock --> Starting Column: 1, Length: 4, Type: Char.
PurDate --> Starting Column: 5, Length: 10, Type: mm/dd/yyyy.
PurPrice --> Starting Column: 15, Length: 6, Type: Dollar Signs and Commas.
Number --> Starting Column: 21, Length: 4, Type: Num.
SellDate --> Starting Column: 25, Length: 10, Type: mm/dd/yyyy.
SellPrice --> Starting Column: 35, Length: 6, Type: Dollar Signs and Commas.
Every time I run it, it tells me, "NOTE: Invalid data for Number" for each line. It makes all my data off (such as the date values and whatnot). I understand that my calculated variables will not work because they're dependent on the Number data that isn't being acquired properly. I'd appreciate any direction people can give me.