How can i read the given updated (date) coloum?
id name salary updated
1 John 35000.00 2018-05-01
2 Peter 42000.00 2019-04-01
3 Peter 54000.00 2017-01-22
4 Sam 58000.00 2018-01-01
5 John 62000.00 2016-01-01
Thanks!
data example; input id name $ salary updated :yymmdd10.; format updated yymmdd10.; datalines; 1 John 35000.00 2018-05-01 2 Peter 42000.00 2019-04-01 3 Peter 54000.00 2017-01-22 4 Sam 58000.00 2018-01-01 5 John 62000.00 2016-01-01 ;
The Informat you should use is yymmdd10. That creates a SAS date value which for people to understand should have a date type format assigned of which there are many.
https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/... has a PDF with much information about dates.
You need to use an informat
data have;
input id $ name $ amount date : yymmdd10. ;
put id= name= amount= date= date=date7. ;
datalines;
1 John 35000.00 2018-05-01
2 Peter 42000.00 2019-04-01
3 Peter 54000.00 2017-01-22
4 Sam 58000.00 2018-01-01
5 John 62000.00 2016-01-01
;
data example; input id name $ salary updated :yymmdd10.; format updated yymmdd10.; datalines; 1 John 35000.00 2018-05-01 2 Peter 42000.00 2019-04-01 3 Peter 54000.00 2017-01-22 4 Sam 58000.00 2018-01-01 5 John 62000.00 2016-01-01 ;
The Informat you should use is yymmdd10. That creates a SAS date value which for people to understand should have a date type format assigned of which there are many.
https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/... has a PDF with much information about dates.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.