SAS Enterprise Guide

Desktop productivity for business analysts and programmers
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Creating Custom Steps in SAS Studio

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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