Oh thank you so much for trying to help me with this. I have wrecked my brain on it! I did figure out some automic code just a few minutes ago that I just got done testing out. It might be little clunky and there are probably better ways to do it – I wish I knew how to write the sql you wrote – I wish I had a sql agent up where I could run the sql codes! Anyway – this is what I came up:
!the current date should be july 1st of any year so this code sets the date as the first
!of the period (july)
:SET &CURDATE# = SYS_DATE()
:SET &DATE# = FIRST_OF_PERIOD ("&CURDATE#:","MM","YYYYMMDD")
:PRINT &DATE#
!this line determines what day of the week the 1st falls on
:SET &DAY# = WEEKDAY_XX(&DATE#)
:PRINT &DAY#
!if the day of the week is a monday, the code adds four days to the 1st and stores the new
!date in the variable table
:IF &DAY# = 'MO'
:SET &FIRST_FRIDAY_JULY = ADD_DAYS('&DATE#', 4)
:PRINT &FIRST_FRIDAY_JULY
:PUT_VAR UCB_TERM,"SRB_FALL_POD2_DATE","&FIRST_FRIDAY_JULY"
:ELSE
!if the day of the week is a tuesday, the code adds three days to the 1st and stores the new
!date in the variable table
:IF &DAY# = 'DI'
:SET &FIRST_FRIDAY_JULY = ADD_DAYS('&DATE#', 3)
:PUT_VAR UCB_TERM,"SRB_FALL_POD2_DATE","&FIRST_FRIDAY_JULY"
:PRINT &FIRST_FRIDAY_JULY
:ELSE
!if the day of the week is a wednesday, the code adds two days to the 1st and stores the new
!date in the variable table
:IF &DAY# = 'MI'
:SET &FIRST_FRIDAY_JULY = ADD_DAYS('&DATE#', 2)
:PUT_VAR UCB_TERM,"SRB_FALL_POD2_DATE","&FIRST_FRIDAY_JULY"
:PRINT &FIRST_FRIDAY_JULY
:ELSE
!if the day of the week is a thursday, the code adds one day to the 1st and stores the new
!date in the variable table
:IF &DAY# = 'DO'
:SET &FIRST_FRIDAY_JULY = ADD_DAYS('&DATE#', 1)
:PUT_VAR UCB_TERM,"SRB_FALL_POD2_DATE","&FIRST_FRIDAY_JULY"
:PRINT &FIRST_FRIDAY_JULY
:ELSE
!if the day of the week is a saturday, the code adds six days to the 1st and stores the new
!date in the variable table
:IF &DAY# = 'SA'
:SET &FIRST_FRIDAY_JULY = ADD_DAYS('&DATE#', 6)
:PUT_VAR UCB_TERM,"SRB_FALL_POD2_DATE","&FIRST_FRIDAY_JULY"
:PRINT &FIRST_FRIDAY_JULY
:ELSE
!if the day of the week is a sunday, the code adds five days to the 1st and stores the new
!date in the variable table
: IF &DAY# = 'SO'
:SET &FIRST_FRIDAY_JULY = ADD_DAYS('&DATE#', 5)
:PUT_VAR UCB_TERM,"SRB_FALL_POD2_DATE","&FIRST_FRIDAY_JULY"
:PRINT &FIRST_FRIDAY_JULY
:ELSE
!if the day of the week is a friday, the code just stores the date in the variable table
: IF &DAY# = 'FR'
:SET &FIRST_FRIDAY_JULY = &DAY#
:PRINT &FIRST_FRIDAY_JULY
:PUT_VAR UCB_TERM,"SRB_FALL_POD2_DATE","&FIRST_FRIDAY_JULY"
:ENDIF
:ENDIF
:ENDIF
:ENDIF
:ENDIF
:ENDIF
:ENDIF
Christine Bauder
Assistant Director of Production Services, University Information Services
University of Colorado
1800 Grant Street, Suite 200
Denver, CO 80203
t 303 860 4334
c 303 263 3288
www.cu.edu<http://www.cu.edu/>
<http://www.cu.edu/uis>