Hi there,
I have a dataset with 1 line per ID with one relevant date per ID.
I have transformed the dates into numeric format using 'date_as_num = putn(date,'yymmddn8.');'.
The date range is 1 January 2018 (i.e. 20180101) to 31 December 2020 (20201231).
I now need to convert these dates into consecutive numbers starting at 1 with 1 January 2018 being 1, 2 January being 2 and so forth.
I'm using SAS version 9.4.
I don't know how to do this. Can anyone help?
Thank you very much!
Julia
Thank you so much, this worked well.
I totally agree, that understanding dates in SAS is worthwhile. I
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.