BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Aexor
Lapis Lazuli | Level 10

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!

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User
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.

View solution in original post

2 REPLIES 2
AMSAS
SAS Super FREQ

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
;
ballardw
Super User
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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 459 views
  • 2 likes
  • 3 in conversation