Hi everyone!
I am trying to run a decision-curve analysis on a macro and attached you will find the code I have used thus far. I continue to get the warning "Apparent invocation of macro DCA not resolved." I am pretty new to using SAS and I am sure there is a decently simple fix to this, however I am not sure where to go or what to do from here. Any help would be much appreciated. Thank you!
Is the Decision Curve Analysis tutorial from Memorial Sloan Kettering Cancer Center?
If so, the dca.sas program, which has the code for the dca macro, is in the "Download SAS Code" zip file. From your screen shot, it looks like you have the files from the last zip file mentioned on that page, which does not include the files for the dca macro or the stdca macro.
You need to compile the macro before you call it.
You could include the definition in your program. Or use the %INCLUDE statement to source the definition from a file.
It looks like you might be trying to use an autocall library since you added HOME to your SASAUTOS option setting.
For that to work the definition for the macro DCA needs to be in a file named 'dca.sas' that is stored in one of the folders or folders pointed to by a filerefs that are listed in SASAUTOS option.
Since you are running on Unix the filename needs to be in all lowercase.
The problem lies in your LIBNAME statement (sort of).
To access SAS data sets in the folder, the LIBNAME statement is correct. However, to access macros via the SASAUTOS option, you would also need a FILENAME statement pointing to the same folder.
LIBNAME for SAS data, FILENAME for text files (which includes macro definitions).
Good point about needing a fileref instead of a libref in the SASAUTOS option.
Note that if you are really using HOME as a libref you also just use the PATHNAME() function to help you use its path in the SASAUTOS setting.
libname home ..... ;
options sasautos = ("%sysfunc(pathname(home))" sasautos);
What order to but your directory in relation to the the SAS supplied macros is determined by whether you want to be able to override the SAS supplied macros with your own definitions or not.
Thank you all for your help so far-these have been great suggestions. Unfortunately, I have tried them out and still seem to be getting the same warning message. I think the problem may be in the way I have my folders set up/files saved to my Mac. Here is a screenshot inclusive of my files. This decisioncurveanalysis folder is from a tutorial on how to perform DCA in SAS, Stata, and R so that's why you will see those files there as well. Hopefully this information will help with resolving this issue. Thank you again!
You need to find the code that defines the macro. It should look like:
%macro dca
....
%mend;
And run that code BEFORE you try to call the macro using the code in your photograph.
Thank you! I think I am making progress...I no longer receive the "invocation of macro..." warning, however I am still receiving this error. Is there a problem with my code for this?
Hi Tom,
I do think this is what the issue is ( defining the DCA macro). The following screenshot is directly from the DCA tutorial code...would this be the code defining the macro?
That is just another example of calling the macro. You need to check the setup instructions in the tutorial to see how they want you to install the actual macro definition. Or search the other code files.
PS The photos of your program are really cute, but if you want to share code it is best to share it as text. Make sure to use the Insert SAS code icon to get a pop-up to paste in the text of your code.
Is the Decision Curve Analysis tutorial from Memorial Sloan Kettering Cancer Center?
If so, the dca.sas program, which has the code for the dca macro, is in the "Download SAS Code" zip file. From your screen shot, it looks like you have the files from the last zip file mentioned on that page, which does not include the files for the dca macro or the stdca macro.
This is exactly where the tutorial is from! Thank you for the heads up, I found the files and it is now running smoothly. Thank you for your help!
Remove the line - %dca (data=dca,outcome=cancer....................)
You are already running the model using Proc Logistic. The macro %dca is only calling the model with outcome and predictors which are already defined in proc logistic.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.