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

I would like to use the box to select the date, e.g. June 30, and then I would like to create a table from the library credit with two columns where Default is 1

This is my code, but nothing happens, the window does not appear, but with the dates from the initial start of the program. How to replace the code so that after pressing the runes, the date selection window will open and then create a table with these two items. Where is the mistake

 

 

%let gv_dateDEF=%sysevalf(%bquote('&data.'d));
%let yy=%sysfunc( YEAR(&gv_dateDEF.),z4.);
%let mm=%sysfunc(MONTH(&gv_dateDEF.),z2.);
%let dd=%sysfunc( DAY(&gv_dateDEF.),z2.);
%let gv_tbl_date=%eval(%str(&yy&mm&dd));
proc sql;
create table NewDef as
select
spr_NRB,
where(spr_DEFAULT = 1)
from credit;
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Is Date in mart_credit a SAS date? Numeric with a format?
What is the name of the prompt with the date and how does it resolve? You can check it with the following:

%put &promptVariable.;

If the date is numeric with a date format and promptVariableValue looks like '01Jun2021' then your code would look like:

where date = "&promptVariable"d;

View solution in original post

22 REPLIES 22
Gieorgie
Quartz | Level 8
are you mean change to : %let gv_dateDEF=%sysevalf(%bquote("&data."d)); ?
Gieorgie
Quartz | Level 8
Thanks a lot! So if i Good understood if i have date in table like 2021-08-31 i should change to yymmddn10. And date to %let date = 2021-08-31? And for example if i have many date in my dataset i can add where date=gv_tbl_date
Kurt_Bremser
Super User

Your code as posted was designed to create a date string of 8 digits with no delimiters. So I did that.

To get 10 digits with hyphens as delimiters, use the YYMMDD10. format.

And I used the DATE9. informat for the initial string because it looks like you have that at this moment. Macro variables created by user prompts of type date will look like that.

 

But if you need this to use as a cutoff for SAS dates, apply no format at all, and use the raw value (number of days since 1960-01-01).

 

So please show what you really get initially in &data, and what you intend to do with the macro variable you create.

 

Gieorgie
Quartz | Level 8

When i run your code still nothing happend. No bugs , no information. Above % let date I also have another code above. Maybe it is a matter that at the start of all code I run a macro with data? However, here also needs to open another date picker. For example, now I am doing a report for September, but in this table I have to take the dates for June

Gieorgie_0-1634226125281.png

 

Gieorgie
Quartz | Level 8

Gieorgie_0-1634226600411.pngI would like to open such a window ( inputox)

Kurt_Bremser
Super User

Inputs for dynamic code are done in Enterprise Guide by defining user prompts. Such user prompts, when defined as type date, will deliver the resulting date in DATE9 format in a macro variable that has the name of the prompt.

 

So what are you trying to do? Please give us the bigger picture.

Gieorgie
Quartz | Level 8
I would like to create such an inputbox, but I do not know how, wich one after clicking on the program, a window with a date selection would appear. and to execute your macro after selecting the date
Kurt_Bremser
Super User

In Enterprise Guide, you create such windows as user prompts; the resulting code + prompts can then be converted to a stored process to be run on the stored process server, either from EG or through the web interface.

In Display Manager, you can use input commands, but I haven't worked with DM in a very long time.

 

Which of the interfaces for the SAS system are you using? Display Manager, Enterprise Guide, SAS Studio?

Gieorgie
Quartz | Level 8

Gieorgie_0-1634228873362.png

I HAVE CREATED A PROMPT CORE DATE BUT HOW TO ASSIGN THIS TO A PROGRAM ?

Reeza
Super User
where date = "&corepdate"d;
Gieorgie
Quartz | Level 8
But how to run prompt to select needed date? How to assigned this prompt to some button / programs

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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