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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.