我在与我的SAS程序正常运行的问题。 有什么毛病,我从我的文件获取数据,它的内部搞乱了一切办法。 这里是我的代码搞乱部分:
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;
这里是我的工作中的数据:
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
该数据描述如下:
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.
我每次运行它,它告诉我,“注:编号无效数据”的每一行。 它使我的所有数据关闭(如日期值和诸如此类的东西)。 据我所知,我的计算变量将无法工作,因为他们依赖于没有被正确采集的数字数据。 我会很感激任何方向的人可以给我。