Hey folks. I joined this board specifically because of this issue. I can't a get query to resolve referencing a date prompt using "&EndMonthDate"d. I'm getting the following error:
Any help would be greatly appreciated!
You can create macro variables in many ways, the simplest of which is:
%let <macrovariable>=<some text>;
But anyway, you have created a prompt within the code you are working with, or made the prompt response available to your code, and you are sure its called EndMonthDate? All I have to go on is the warning, and that is clearly stating that does not exist, so either its not called that, or not available in the session you are running the given code.
The warning is telling you that in that SAS session there is no macro variable called EndMonthDate. Not sure what else we can say other than check where it is being created, maybe you missed a %let statement, or something else is not included or setup??
Forgive my novice, but how else do you create a macro variable? Is a prompt sufficient? Because it has been created and is in use throughout other parts of the project.
You can create macro variables in many ways, the simplest of which is:
%let <macrovariable>=<some text>;
But anyway, you have created a prompt within the code you are working with, or made the prompt response available to your code, and you are sure its called EndMonthDate? All I have to go on is the warning, and that is clearly stating that does not exist, so either its not called that, or not available in the session you are running the given code.
Here's an image of my prompt window:
I figured it out with your advice. In the query window you go to Options >> Options for this Query >> Prompts. I added the prompts there and it resolved. Thanks!
What value was actually entered for the prompt? Was something actually entered or selected for the propmpt?
Your code implies that the value entered should be a date. The prompt would have to be of the form ddmonyy or ddmonyyyy such as
05May2018 or 5May18. No spaces, no other format like 5/5/2018, no punctuation.
It's a GUI created prompt. I don't have the option of choosing a date format. So I assume SAS EG is selecting the appropriate formatting:
Did you right-click on your program, select Properties > Prompts, and add your prompt to be used by the program?
Tom
It's in a query not a program
I've written programs but I'm no expert. I don't see where I can add a prompt to a query. Please advise...
Same solution. Save your query, even though it's displaying an error message, then right-click on it, Properties > Prompts, and pick your prompt. I just tried it, it worked fine.
Thanks it resolved following a similar solution from 'Options' in the query window
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.