Hello, I have scoured the internet to no avail. I'm hoping someone would be able to help. I need to interact dummy variables for the day of the week and the hour of the day. I really don't want to hard code 168 variables. I have to do this pretty regularly so I feel like learning a loop based method to would really help. I already have the weekday and hour dummies that are 1 if true. I would like to create 168 interactions that have names like day1_he1 ... day7_he24 that = 1 when the specified day and specified hour are both 1. I am using SAS eg with base 9.02. I have a date variable and a variable called HE which is the hour of the day. Here is what I have tried: data work.sample_data; set work.sample_data; weekday = weekday(date); array ar_day{*} day1-day7; do j = 1 to 7; ar_day(j) = (weekday=j); end; array ar_he{*} he1-he24; do k = 1 to 24; ar_he(k) =(he=k); end; do l = 1 to 7; do m = 1 to 24; day&l_he&m = day&l*he&m; end; end; run; Ther error I receive is: WARNING: Apparent symbolic reference L_HE not resolved. WARNING: Apparent symbolic reference M not resolved. WARNING: Apparent symbolic reference I not resolved. WARNING: Apparent symbolic reference M not resolved. ERROR 180-322: Statement is not valid or it is used out of proper order. Any help is appreciated.
... View more