i got stuck in this problem and it is not showing sas format date value .
data out;
input CALL_NO 1-3
DATE 5-12
TRUCKS 14-15
ALARM 17;
informat date mmddyy8.;
datalines;
001 10/21/94 03 2
002 10/23/94 01 1
003 11/01/94 11 3
;
run;
data out;
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
;
run;
Hi @Arpit2 and welcome to the SAS Support Communities!
The documentation "INPUT Statement: Column" says: "To read with column input, data values must ... consist of standard numeric form or character form." So, date values in the form "mm/dd/yy" preclude column input. Just switch to list input by deleting the column specifications (1-3, ..., 17) in your DATA step. The suggested FORMAT statement is useful for displaying the date values, but not necessary for reading the raw data.
You cannot use column mode input statement and an INFORMAT. You will need to either read the value as character and use INPUT() function to generate the date value. Or read at least that one field using formatted mode input instead.
data out;
input
CALL_NO 1-3
@5 DATE mmddyy8.
TRUCKS 14-15
ALARM 17
;
format date mmddyy10.;
datalines;
001 10/21/94 03 2
002 10/23/94 01 1
003 11/01/94 11 3
;
Or if you are positive that every variable has a value (or when missing a period) then use list mode input. In that case you can either use the INFORMAT statement to set the informat for the variable or include the informat in the input statement but add the : modifier so that it still does list mode input.
data out;
input
CALL_NO
DATE :mmddyy8.
TRUCKS
ALARM
;
format date mmddyy10.;
datalines;
001 10/21/94 03 2
002 10/23/94 01 1
003 11/01/94 11 3
;
PS Do NOT use only two digits for year values.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.