***Export a SAS Dataset to CSV File;
%macro test;
DATA x; x=today(); FORMAT x MMDDYYN8.; RUN;
PROC SQL NOPRINT; SELECT x INTO :x FROM x; QUIT; %PUT &x;
OPTIONS missing="";
DATA _NULL_;
SET AAA.sales END=last;
dateheader=compress("H""&x");
FILE "/abc/dev/xyz/sales.csv" DLM=',';
IF _N_=1 THEN PUT dateheader;
var=compress(fcst_acct_yr_i','fcst_acct_mo_i','fcst_acct_mo_wk_i','str_i','sales);
PUT var;
IF last THEN DO;
e=compress("T"_N_);
PUT e;
END;
RUN;
%mend test;
%test;
***Import a CSV File to SAS Dataset;
%let IN_file=/abc/dev/xyz;
%macro test;
PROC IMPORT OUT=WORK.Temp DATAFILE="&in_file.dummy.csv"
DBMS=CSV REPLACE; GETNAMES=YES;
RUN;
%mend test;
%test;
No comments:
Post a Comment