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!

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