DATA Step, Macro, Functions and more

macro date format for automation

Reply
Frequent Contributor
Posts: 125

macro date format for automation

automate date in oracle pass through query using intnx instead of hard code

Contributor
Posts: 26

Re: macro date format for automation

Posted in reply to chennupriya

Hi,

Please could you elobrate ur issue with an example

 

Rgds,
Abhi

Frequent Contributor
Posts: 132

Re: macro date format for automation

Posted in reply to chennupriya

You may want to be more specific as far as what you want the macro variable to do or be equal to, but here's a brief example using 10 days ago from the current date (this is assuming your Date Variable in the Oracle Table is Date and not DateTime):

 

%let today=%sysfunc(today(),date9.);
%let date=%sysfunc(intnx(DAY,"&today"d,-10),date9.);
%put *** Today Macro = &today AND Date Macro = &date ***;

proc sql;
connect to oracle (/*database options*/);
create table want as select * from connection to oracle
	(select *
	 from /*name of table*/
	 where /*name of date variable*/>="&date"d);
quit;
Ask a Question
Discussion stats
  • 2 replies
  • 260 views
  • 0 likes
  • 3 in conversation