How do I save a SAS numeric date value into SAS date format in PROC SQL. Currently, I have a DATA step to convert the variable to SAS date format using FORMAT mydate MMDDYY10. Can I directly convert the SAS numeric value to date format(mm/dd/yyyy) in PROC SQL ? Appreciate any assistance. Thank you
Yep.
intnx('month',serv_from_date, 0,'e') as EOM_DOS format=mmddyy10.
Sure, you can use SAS functions and formats in SQL so long as your not using pass-through, e.g:
proc sql; create table want as select date_num format=mmddyy10. from have; quit;
I am creating a new variable for the end of the month of my service date , can I use the FORMAT function below? Sorry, I am a SAS newbie.
proc sql;
create table want as
select
serv_from_date,
intnx('month',serv_from_date, 0,'e') as EOM_DOS
from have;
quit;
Just use @RW9 code within new variable as
proc sql;
create table want as
select
serv_from_date,
intnx('month',serv_from_date, 0,'e') as EOM_DOS format =mmddyy10.
from have;
quit;
Yep.
intnx('month',serv_from_date, 0,'e') as EOM_DOS format=mmddyy10.
Perfect. Thank you all!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.