- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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??
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Here's an image of my prompt window:
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Did you right-click on your program, select Properties > Prompts, and add your prompt to be used by the program?
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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...
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks it resolved following a similar solution from 'Options' in the query window