I am trying to set up a report with the input dates always today and 1 week back. I am able to get these macro variables into the correct form as strings, but when I go to try to use them in a sql query (below) the fact that they are strings causes an error. I have thought about just using a data step and changing the format in the datastep, but for this particular query a datastep takes forever. Any suggestions would be very helpful.
Explore using SAS data literals where the string is surrounded in double-quotes and suffixed with a "D" character, telling SAS that the character literal is to be interpreted as a DATE. Or depending on the format (if not ddmmmyyyy or ddmmmyy format) you could also use the SAS INPUT function to read up a character string and let SAS covert it to a SAS numeric variable (internall represented as days since 1/1/1960).
Have a look at the SAS support http://support.sas.com/ website and use the SEARCH facility to look for the phrase Working with Dates - you will find several DOCUMENTATION links and supplemental technical/conference papers referenced.
Thanks! I didn't know about using the double quoted literals. Previously when I used the single quotes the macro wouldn't be evaluated. The double quotes seem to fix the problem if I use the %str function.