03-08-2012 07:00 AM
As a way to improve sql joins with other rdbms I wanted to build a macro that give a datetime value or a column containing datetime values it would output only the year and month.
If I ever pass a hardcoded value of a date then it would return the value using a sysfunc (in order to make our joins faster), if it was a column value or any other expression it would use the put function.
I want something like this:
%if &value is hardcoded date (either in '31dec2011:00:00:00'dt or 1672531200 formats)
But I still cound not find a way to make that %if condition, anyone has ideias on this?
03-08-2012 06:20 PM
How will the result of your code be used? In a data step? value in line somewhere else?
If you provide an example of how the macro is to be called in code and the expected output you'll get better help.
03-08-2012 06:31 PM
It is to be used with data integration studio, so it will be in a where clause in a proc sql
select * from oracle_table
select * from table1, table2
03-08-2012 09:09 PM
I do not understand why you think you need a macro for this.
If you have a value in a macro variable then just use it in the PUT statement the same as you would a variable reference.
Here are some examples.
Valid values for the macro variable VALUE could be a date literal, an actual date value as the number of days since 1/1/1960, or the name of a variable that has a date.