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;
Macro triggers will not be resolved when inside single quotes.
And your whole conversion can be simplified to this:
%let data = 30jun2021;
%let gv_tbl_date = %sysfunc(inputn(&data.,date9.),yymmddn8.);
%put &=gv_tbl_date.;
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.
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
I would like to open such a window ( inputox)
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.
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?
I HAVE CREATED A PROMPT CORE DATE BUT HOW TO ASSIGN THIS TO A PROGRAM ?
WHICH.
INTERFACE.
DO.
YOU.
USE?
As long as you refrain from really answering our questions, we will not be able to help you.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.