BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BNK720
Calcite | Level 5

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:

sas error.PNG

 Any help would be greatly appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.  

View solution in original post

11 REPLIES 11
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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??

BNK720
Calcite | Level 5

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.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.  

BNK720
Calcite | Level 5

Here's an image of my prompt window:

pompt pic.PNG

BNK720
Calcite | Level 5

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!

ballardw
Super User

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.

 

BNK720
Calcite | Level 5

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:

date prompt pic.PNG

TomKari
Onyx | Level 15

Did you right-click on your program, select Properties > Prompts, and add your prompt to be used by the program?

 

Tom

BNK720
Calcite | Level 5

It's in a query query pic.PNGnot a programprogram pic.PNG I've written programs but I'm no expert. I don't see where I can add a prompt to a query. Please advise...

TomKari
Onyx | Level 15

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.

BNK720
Calcite | Level 5

Thanks it resolved following a similar solution from 'Options' in the query window

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 11 replies
  • 2524 views
  • 0 likes
  • 4 in conversation