I am trying to convert a date variable into an 8 digit numeric field (YYYYMMDD).
Currently it is in MMDDYY10. format and informat.
Example:
What is occuring:
Current_DATE = 08/01/2015
What I want:
Current_Date = 20150801
Any suggestions?
First question: why?
Storing as a date will give you all the flexibility of using formats and functions adopted for dates.
If you persist, nest input() and put() functions.
First question: why?
Storing as a date will give you all the flexibility of using formats and functions adopted for dates.
If you persist, nest input() and put() functions.
Thanks.
I am setting up datasets to run through a SAS program that someone else wrote. The instructions say to use numeric values for dates.
Here is the code I used for reference:
DATA ENROLLMENT_UPDATE;
SET ENROLLMENT;
DOBNEW=input(PUT(DOB, yymmddn8.),8.);
RUN;
DOB is (probably) already numeric. So when you say that the program expects numeric values, you need to know which numeric values it expects. It may be that you don't need to change a thing.
You can Keep it as a SAS date but display it that way
format date yymmddn8.;
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.