I execute the proc sql pass through (Teradata to SAS).
%let sql=select current_date from sys_calendar.calendar
proc sql noprint;
CONNECT TO TERADATA(Authdomain= SERVER= mode=);
CREATE table &number AS SELECT * FROM CONNECTION TO TERADATA (&sql.);
DISCONNECT FROM TERADATA; QUIT;
I have a problem because I am seeing date format as DATEw. but I need format 'YYYY-MM-DD'.
I know I can do that:
select a, period_date format=yymmdd10. as c, b FROM CONNECTION TO TERADATA
I have a date format: 13MAY2016, but I need: '2016-05-12' but I have about 150 sqls, so I prefer a more global solution than a new format for each sql. Can I use some options? I need the same for each date, so I wolud like do that in global way.
Hello @aola;
You can use SASDATEFMT option like that in your query;
( sasdatefmt=( date1='datetime21.') )
This is the link for more info:
http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a001371624.htm
You can always change these format after importing into SAS.
Assuming all the table stored at WORK library.
%let lib=work;
data _null_;
set sashelp.vcolumn(where=(libname="%upcase(&lib)" and format='DATE9.')) end=last;
by memname;
if _n_=1 then call execute(catt("proc datasets library=&lib nolist nodetails;"));
if first.memname then call execute(catx(" ","modify ",memname,"; format"));
call execute(catx(" ",name," yymmdd10."));
if last.memname then call execute(";");
if last then call execute("quit;");
run;
Thank you, you're amazing 🙂
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.