yongyitian 发表于 2013-3-7 08:07 
/* Try this, */
data Test_F;
input date yymmdd8. PRC QTY key $ deal $4. ;
Y大,问个小小问题,
假如原本我已经把数据输入到SAS了,
在WORK中档名叫做a1;
(不需要用datalines 把数据输入),
我想要用set a1,这个方式,输入数据,
那么,以下这部分的语法,应该要如何修改呢?
data Test_F;
input date yymmdd8. PRC QTY key $ deal $4. ;
format date date9. time hhmm5.;
time = hms(substr(deal,1,2),substr(deal,3,2),0);
datalines;
20050602 242.2 1 TE 0904
20050602 242.5 1 TE 0936
20050602 242.8 1 TE 1008
20050603 6022 2 TX 1009
20050603 6023 2 TX 1015
20050830 6075 1 TX 0922
20050831 6049 1 TX 1106
20050909 6146 2 TX 0936
20050926 5936 1 TX 1232
20051003 6162 3 TX 1258
20051013 5972 1 TX 0806
20051025 5789 5 TX 0930
20051025 5789 1 TX 0940
; run;
proc sort data=Test_F;
by date Time;
run;
小弟不懂,为什么我直接SET a1的数据,
然后用 time = hms(substr(deal,1,2),substr(deal,3,2),0);
去跑,为什么跑出来time都是”.” (~”~)
然后LOG里面显示
1110 dataa2;
1111 seta1;
1112 time= hms(substr(deal,1,2),substr(deal,3,2),0);
1113 run;
NOTE: Numeric values have been converted tocharacter values at the places given by: (Line):(Column).
1112:21 1112:38
NOTE: Character values have been converted tonumeric values at the places given by: (Line):(Column).
1112:14 1112:31
NOTE: Missing values were generated as a resultof performing an operation on missing values.
Eachplace is given by: (Number of times) at (Line):(Column).
28 at 1112:10