Reputation: 4674
I would like to know how to create a (date/time) column in my data set with a comma delimiter. A few months ago I googled around and figured how to, but I accidently deleted that file and couldn't find the ways anymore...
I think it's something to do with input
, any tips?
data INPUT;
infile datalines delimiter=',';
input CINNUMBER $1-8 DATE $10-20;
datalines;
AB12345C, 01/01/2017
;
RUN;
Thank you, George
Upvotes: 1
Views: 2209
Reputation: 27536
DATA INPUT;
infile datalines delimiter=',';
attrib
CINNUMBER length = $8
DATE length = 8 format = mmddyy10. informat = mmddyy10.
;
input CINNUMBER DATE ;
datalines;
AB12345C, 01/01/2017
;
RUN;
SAS has a few styles of input. The above demonstrates list input. This is probably the safest style for comma separated data. The ATTRIB
statement defines the variables and their attributes before the INPUT
statement. Input processing will use the INFORMAT
MMDDYY10.
for reading the mm/dd/yyyy data field into your DATE
variable.
Upvotes: 3