Create calendar with SAS/AF

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

Create calendar with SAS/AF

Helloo, 

 

I'd like some help with SAS/AF, I know it's kinda old but it's for a project, I have to make a dynamic calendar, which means days are automatically displayed when the user goes through the years/months. A bit like the Windows Calendar we have.

 

So I have this Data set :

%let fromDate = 31DEC2005;
%let toDate = 31DEC2016;
data calendar;

  do date = "&fromDate"d to "&toDate"d; 
    DayOfWeek = put(date, downame3.);
    Day = put(date, day.);
    Month=month(date);
    Year=year(date);
    output; 
  end; 

  format 
    date date9.
  ;
run;

and my calendar looks like the attached image. 

 

The only thing I need to do now is set the days in the Push Buttons (takes values 1-31) though I want the values to be updated following the data set, as soon as the user changes the month/year from the combo/spin boxes. (didn't decide which one to choose yet)

 

I am new to SCL I don't know how to put all these things together, thank you for your help ! 

Also I'm sorry if it's not the proper section.


input.PNG

Accepted Solutions
Solution
‎07-02-2016 09:06 AM
PROC Star
Posts: 1,558

Re: Create calendar with SAS/AF

[ Edited ]

Sadly I can no longer use SAS/AF since crippled EG has been forced onto me, and it has been a few years since I last used SCL.

 

So here is the pseudo code I would use. You'll have to modify it to make it work, but maybe it will help you get started.

 


main:
  first_button=put("&fromDate"d,eurdfdn.);                           %* say 3 for Wednesday;
  DAY=.;
  do button_nb = 1 to 35;
    if button_nb < first_button then button[button_nb]=' ';          %* button 1,2 is set to blank;
    if button_nb = first_button then DAY=0;                          %* 3rd button is start of month;
    DAY=DAY+1;
    if DAY then button[button_nb]=put(DAY,2.);                       %* next buttons set to date;
    if month(intnx('day',"&fromDate"d,DAY)) ne month("&fromDate"d)   
      then button[button_nb]=' ' ;                                   %* if past EOM then set to missing;
  end;
return;

 

 

 

View solution in original post


All Replies
Solution
‎07-02-2016 09:06 AM
PROC Star
Posts: 1,558

Re: Create calendar with SAS/AF

[ Edited ]

Sadly I can no longer use SAS/AF since crippled EG has been forced onto me, and it has been a few years since I last used SCL.

 

So here is the pseudo code I would use. You'll have to modify it to make it work, but maybe it will help you get started.

 


main:
  first_button=put("&fromDate"d,eurdfdn.);                           %* say 3 for Wednesday;
  DAY=.;
  do button_nb = 1 to 35;
    if button_nb < first_button then button[button_nb]=' ';          %* button 1,2 is set to blank;
    if button_nb = first_button then DAY=0;                          %* 3rd button is start of month;
    DAY=DAY+1;
    if DAY then button[button_nb]=put(DAY,2.);                       %* next buttons set to date;
    if month(intnx('day',"&fromDate"d,DAY)) ne month("&fromDate"d)   
      then button[button_nb]=' ' ;                                   %* if past EOM then set to missing;
  end;
return;

 

 

 

New Contributor
Posts: 3

Re: Create calendar with SAS/AF

Hello, Thank you very much for stopping by !

 

I have severl errors like "Undeclared array reference"  for button, also I didn't understand how is it supposed to "change" the actual value of the button ? the "1" in the image is the value of the "label" attribute, am I not going to use it ?

 

Thank you once more !

PROC Star
Posts: 1,558

Re: Create calendar with SAS/AF

Yes you have to adapt the code.

I don't know the names of your widgets so I called them in via an array. You can declare an array in SCL (SCL has nice array functions actually) and so the same thing.

Yes set the label property to change it.

Sorry I can't provide you with better code. I blame SAS for pushing EG down our throats.

Feel free to ignore if it doesn't help you.

 

New Contributor
Posts: 3

Re: Create calendar with SAS/AF

Hey thank you so much, I've been working on something, it helped a lot !

Thank you !
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 347 views
  • 0 likes
  • 2 in conversation