10-17-2016 06:38 AM
Hello, I have a SQL-code with connection to Teradata. Incide this code SAS macro - %month_diff_td. How can I view (and change) the code?
I use %copy
%copy MONTHS_DIFF_TD() / SOURCE;
but it doesn't help:
14 GOPTIONS ACCESSIBLE; ERROR: This combination of default and specified %COPY statement options is not supported. ERROR: An error occurred during the execution of the %COPY statement. 15 %copy MONTHS_DIFF_TD() / SOURCE; _ 180 ERROR 180-322: Statement is not valid or it is used out of proper order.
May be I can use some fing tool using macro name?
10-17-2016 06:46 AM - edited 10-17-2016 06:48 AM
Look at the source code which created the macro? If you don't have the source code and only have the compiled catalog then that should work, unless of course the catalog is set to protect the contents - one thing which I detest in programming. This is why I strongly advise against the use of catalogs in any sense as the whole 32/64bit debacle has proved.
Oh, and you don't specify ():
Assuming months_diff_td is the correct name of the macro.
10-17-2016 07:37 AM
When I drop "()" I have error
ERROR: Macro MONTHS_DIFF_TD not found in libref MAMACRO.
ERROR: An error occurred during the execution of the %COPY statement.
Macro is exist! I found in by hands (running over all folders)
%macro MONTHS_DIFF_TD(date1,date2); cast(((&date2 - &date1) month(3)) as integer ) %mend;
10-18-2016 08:46 AM
- You can check your autoexec.sas (or other startup files) and see if there is an:
Statement there - that is the first place SAS looks for them.
- Then your programs could include further ones or define them - so look at your startup files, and any other programs you run.
- Finally, there is the proc scaproc procedure, which does some code analyzing, you start it before your run, then after to get some results - however this might not capture everything if they are set in start programs.
i suppose the question at the end of the day is why you don't know where the macros are, I mean to be able to use macros you should know something about them. I know most don't bother, but properly developed code should have user guides, testing and such like that you should be aware of before using them, much like any software development.
10-17-2016 06:50 AM
You seem to misunderstand what the macro statement %copy does.
Look at the documentation here: %COPY Statement