1cutedimple
Programmer
Hi, I have a dataset w/ date fields and datetime fields and I need to it in a certain format in a text file (no dashes). I'm using the compress function but tt's giving me a syntax error and not sure how to fix it. Here is my code. Anyone tell me how to fix it?
libname a ...;
%let out_file = ...\temp_data_new.txt';
%let in_file = ...\temp_data_new.txt';
data _NULL_;
set a.temp_data;
file &out_file;
put TO_DT YYMMDD10.
FROM_DT YYMMDD10.
PERMSN_TS DATETIME18.
;
run;
data temp (keep = TO_DATE FROM_DATE);
file &in_file;
input TO_DT $1-10 FROM_DT $11-20
TO_DATE = compress(TO_DT,'-');
FROM_DATE = compress(FROM_DT,'-');
run;
proc sql;
create table a.tempdata as
(select TO_DATE, FROM_DATE from temp);
quit;
libname a ...;
%let out_file = ...\temp_data_new.txt';
%let in_file = ...\temp_data_new.txt';
data _NULL_;
set a.temp_data;
file &out_file;
put TO_DT YYMMDD10.
FROM_DT YYMMDD10.
PERMSN_TS DATETIME18.
;
run;
data temp (keep = TO_DATE FROM_DATE);
file &in_file;
input TO_DT $1-10 FROM_DT $11-20
TO_DATE = compress(TO_DT,'-');
FROM_DATE = compress(FROM_DT,'-');
run;
proc sql;
create table a.tempdata as
(select TO_DATE, FROM_DATE from temp);
quit;