BookmarkSubscribeRSS Feed
Multipla99
Quartz | Level 8

I would like to build a prompt in SAS EG 8.2 that gives the user a list of years to chose from. The list should include all years from, lets say t-3 to t+1, where t is the current year. As you can see in the example below I started out quite well. However, now I would like the "list of values" to be populated, dynamically, with the years  2019-2023, assuming that the current year is 2022. Next year, 2023, the "list of values" should be populated dynamically with 2020-2024 and so on.

 

How can I acheive this? 

 

Skärmbild 2022-11-25 185515.png

 

 

 

4 REPLIES 4
AhmedAl_Attar
Ammonite | Level 13

Hi @Multipla99 

Looking at your screen shot, I see two contradicting settings!
Method for populating prompt: User selects values from a static list
vs.

your requirement: the "list of values" should be populated dynamically

 

To achieve 100% automatic dynamic list of values,  You'll need to

1. Create a Dataset view 

data <lib>.dyn_years/view=<lib>.dyn_years;
   do year=(year(date())-3) to (year(date())+1);
       output;
   end;
run;
AhmedAl_Attar
Ammonite | Level 13

@Multipla99 

Just to continue where I left-off

2. Register the newly created dataset view (<lib>.dyn_years) into your Metadata Server (If you have one), and save it in accessible Metadata folder

3. Change the Method for populating prompt to: User selects values from a dynamic list

4. Specify/select the newly created dataset view (<lib>.dyn_years) as the Data source:, and populate additional fields as needed.

 

Otherwise, I don't think there is automated way to convert static list into dynamic  

Hope this helps,

Ahmed

Multipla99
Quartz | Level 8

Thank you so much, AhmedAl_Attar, for helping me with this!

 

You say that I could save the suggested view in the accessible metadata folder. I definitely have a Metadata server, see below, but I don't know how to find the accessible Metadata folder. Is this folder something you can help me to locate?

 

Skärmbild 2022-11-29 153328.png

AhmedAl_Attar
Ammonite | Level 13

@Multipla99 

You'll have to coordinate with your SAS Administrator, as he/she should have access to SAS Management Console or other tools that would register Library references, tables, views, and security controls for your SAS environment

 

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
  • 4 replies
  • 1898 views
  • 5 likes
  • 2 in conversation