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

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
1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

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

4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

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;

 

 

 

Xibition
Calcite | Level 5

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 !

ChrisNZ
Tourmaline | Level 20

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.

 

Xibition
Calcite | Level 5
Hey thank you so much, I've been working on something, it helped a lot !

Thank you !

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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