BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
N_C
Calcite | Level 5 N_C
Calcite | Level 5

My data is imported from a csv file.  In the csv file, I have a date field showing dates in the format, 22/05/39.  When I click on the cell I can see that the date is in reference to the year 2039 but when I import it to SAS, it shows as 1939.  

 

Can anyone help me with a way around this please? 

 

Thanks. 

1 ACCEPTED SOLUTION
6 REPLIES 6
N_C
Calcite | Level 5 N_C
Calcite | Level 5

Thanks, I agree!  I can get around it like that but was hoping there was an alternative solution so that I didn't have to reformat the data every month. 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

On your import program (which you haven't shown us so I can only guess), in the datastep have a line:

date=intnx('year',date,100);

This will move the date's year on 100.  You will have to fix yourself or alter system options as the data is "bad".

N_C
Calcite | Level 5 N_C
Calcite | Level 5

Thanks but I can't do this as my data spans more than 100 years.  I think the only option is to format the data in Excel to show 4 digits as per KurtBremser response. 

 

ballardw
Super User

I hope that you have the correct values. If the file is csv and then opened in Excel and formatting applied sometimes values get "interpretted" by Excel in ways that may not quite be as desired.

 

Note that Excel is likely using a similar approach to the YEARCUTOFF so be careful about saving over your original file.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 6 replies
  • 3574 views
  • 1 like
  • 4 in conversation