BookmarkSubscribeRSS Feed
sheller
Calcite | Level 5

Hello, 

 

I was hoping someone would be able to help me figure out how to create a prompt that is a string. In one of the tables I use the date is fromatted as a string and is always in the following format YYYY-MM-DD. I would like to creat prompts so I do not have to go itno each query and change the filter. When I tried creating the prompt for the date field and it doesn't seem to work.

 

Does anyone know how to make this work? 

 

Thanks! 

2 REPLIES 2
ballardw
Super User

It doesn't hurt to mention which version of EG you are using as options may vary.

 

Describe in some detail how you created the prompt for the date and what symptoms that "it doesn't seem to work".

Can you echo the value of the prompt and does it look correct?

Did you try to make it a SAS date value? If the dates in your data are string then any comparisons with SAS date values will likely fail.

Or vice versa, if your prompt is a string of that format and your SAS data has date values there isn't any easy way to compare.

How are you using the prompt?

AirtonNunes
Calcite | Level 5

Try it:

 

1 - Create your prompt as a date type and variable name DateRef.

2 - Change your variable from string to sas date format using a %let command. %let DateRef = %sysevalf("&DateRef"d);

3 - Use your var &DateRef!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

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
  • 2 replies
  • 1387 views
  • 0 likes
  • 3 in conversation