c*****7 发帖数: 54 | 1 对于图1中的问题,我编的code如下(可以运行):
DATA RESPOND;
INPUT CALL_NO 1-3 @5 DATE MMDDYY8. TRUCKS 14-15 ALARM 17;
FORMAT DATE MMDDYY8.;
DATALINES;
001 10/21/94 03 2
002 10/23/94 01 1
003 11/01/94 11 3
;
PROC PRINT DATA=RESPOND;
RUN;
但是如果我按照如下两种code就运行不成功,但是一直不知道原因何在啊?
第一种:
DATA RESPOND;
INFORMAT DATE MMDDYY8.;
INPUT CALL_NO 1-3 DATE 5-12 TRUCKS 14-15 ALARM 17;
DATALINES;
001 10/21/94 03 2
002 10/23/94 01 1
003 11/01/94 11 3
;
PROC PRINT DATA=RESPOND;
RUN;
第二种:
DATA RESPOND;
INFORMAT DATE MMDDYY8.;
| p********a 发帖数: 5352 | 2 1. You are using column input. The informat statement has no effect. Also,
you must specify $ for char vars. Here you read date as a char var, then
transfer it into date var.
2. No such input method at all. You must specify $ for char vars. | c*****7 发帖数: 54 | 3 你看我给你的附件,这就是个反例,对于date既用了INFORMAT,又用了FORMAT啊
【在 p********a 的大作中提到】 : 1. You are using column input. The informat statement has no effect. Also, : you must specify $ for char vars. Here you read date as a char var, then : transfer it into date var. : 2. No such input method at all. You must specify $ for char vars.
| o****o 发帖数: 8077 | 4 you can't use informat and position at the same time. The position code will
serve as $ informat of specific length. try to delete the 5-10 after DATE:
DATA RESPOND;
INFORMAT DATE MMDDYY8.;
INPUT CALL_NO 1-3 DATE TRUCKS 14-15 ALARM 17;
DATALINES;
001 10/21/94 03 2
002 10/23/94 01 1
003 11/01/94 11 3
;
run;
and for the second non-executable code, you forget a ";" after FORMAT statement
【在 c*****7 的大作中提到】 : 对于图1中的问题,我编的code如下(可以运行): : DATA RESPOND; : INPUT CALL_NO 1-3 @5 DATE MMDDYY8. TRUCKS 14-15 ALARM 17; : FORMAT DATE MMDDYY8.; : DATALINES; : 001 10/21/94 03 2 : 002 10/23/94 01 1 : 003 11/01/94 11 3 : ; : PROC PRINT DATA=RESPOND;
|
|