@paulskie08 wrote:
I hovered over the query_date variable and it's a SAS date value.
All the values under query_date are in the same format (i,e, 29JUL2021, 18MAY2021, 01SEP2022)
I was initially trying to have the query_date output as 2023-01-01, but as long as I can show that all the dates are equal or greater than 01JAN2023, I should be good. Sorry if I didn't word it properly.
A FORMAT in SAS is just instructions for how to convert the values stored in the variable into text. The format attached to the variable is independent of the values stored.
A data value in SAS is a number representing the number of days since the start of 1960. If you display it using the DATE9. format it will look like 29JUL2021. If you display it with the YYMMDD10. format it will look like 2023-07-29.
1440 data _null_;
1441 date='29JUL2023'd ;
1442 put date= comma12. +1 date date9. +1 date yymmdd10. ;
1443 run;
date=23,220 29JUL2023 2023-07-29
In SQL if you want to attach a format to variable use the FORMAT= option after the variable definition.
create table want as
select id, datevar format=yymmdd10.
from have
;
... View more