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

Can someone help me with the code to convert this numberic date format to ISO8601 fomat (like17OCT2016 2 time 9:10:04 to 2016-10-17T09:10:04), but I want to have a generic code even for missing date or month or both . I am trying to Converting Non-Imputed Partial Dates for a sdtm dataset. how to delete the wrong numbers for time notation (like hours upto 24, minutes upto 60, upto 60 sec etc) 

eg:

2016-10-17T09:10:04
2016-10--T09:10:04
2016----T09:10:04
2016-10-17T-:10:04
2016-10--T09:10:04
2016----T09:10:04

2016-10-17T00:10:04
2016-10-17T09:00:04
2016-10-17T09:10:00

                  please correct me if this notation is wrong in sdtm ISO 8601 fomat?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Geethakrishna
Calcite | Level 5

Hi

 

check below link if you can locate solution for your problem

 

http://www.lexjansen.com/nesug/nesug10/ph/ph11.pdf


@buddha_d wrote:

Can someone help me with the code to convert this numberic date format to ISO8601 fomat (like17OCT2016 2 time 9:10:04 to 2016-10-17T09:10:04), but I want to have a generic code even for missing date or month or both . I am trying to Converting Non-Imputed Partial Dates for a sdtm dataset. how to delete the wrong numbers for time notation (like hours upto 24, minutes upto 60, upto 60 sec etc) 

eg:

2016-10-17T09:10:04
2016-10--T09:10:04
2016----T09:10:04
2016-10-17T-:10:04
2016-10--T09:10:04
2016----T09:10:04

2016-10-17T00:10:04
2016-10-17T09:00:04
2016-10-17T09:10:00

                  please correct me if this notation is wrong in sdtm ISO 8601 fomat?

 



@buddha_d wrote:

Can someone help me with the code to convert this numberic date format to ISO8601 fomat (like17OCT2016 2 time 9:10:04 to 2016-10-17T09:10:04), but I want to have a generic code even for missing date or month or both . I am trying to Converting Non-Imputed Partial Dates for a sdtm dataset. how to delete the wrong numbers for time notation (like hours upto 24, minutes upto 60, upto 60 sec etc) 

eg:

2016-10-17T09:10:04
2016-10--T09:10:04
2016----T09:10:04
2016-10-17T-:10:04
2016-10--T09:10:04
2016----T09:10:04

2016-10-17T00:10:04
2016-10-17T09:00:04
2016-10-17T09:10:00

                  please correct me if this notation is wrong in sdtm ISO 8601 fomat?

 


 

View solution in original post

6 REPLIES 6
data_null__
Jade | Level 19

Show what you have and what you want.

buddha_d
Pyrite | Level 9

I want to have a generic code for any missing value in the format 

ballardw
Super User

Are you attempting to create SAS datetime values? SAS will not allow creation of a date/datetime with missing components such as month or day the value would always have an assumed month/day. For instance, if you want a SAS datetime value, 2016----T09:10:04 would require something for day and month. Could it be that for your data you want to use the month or day of the month from the previous record (assuming this data is collected in some sort of sequence)?

 

 

buddha_d
Pyrite | Level 9

I don't want to impute anything for the missing date or time values. But this is what i want.

 

INPUT DATA:
17OCT2016 9:10:04
UNOCT2016 9:10:04
UNOWN2016 9:10:04
17OCT2016 :10:04
UNOCT2016 9::04
UNOWN2016 9:10:

 

output should look like this
2016-10-17T09:10:04
2016-10--T09:10:04
2016----T09:10:04
2016-10-17T-00:10:04
2016-10--T09:00:04
2016----T09:10:00

Geethakrishna
Calcite | Level 5

Hi

 

check below link if you can locate solution for your problem

 

http://www.lexjansen.com/nesug/nesug10/ph/ph11.pdf


@buddha_d wrote:

Can someone help me with the code to convert this numberic date format to ISO8601 fomat (like17OCT2016 2 time 9:10:04 to 2016-10-17T09:10:04), but I want to have a generic code even for missing date or month or both . I am trying to Converting Non-Imputed Partial Dates for a sdtm dataset. how to delete the wrong numbers for time notation (like hours upto 24, minutes upto 60, upto 60 sec etc) 

eg:

2016-10-17T09:10:04
2016-10--T09:10:04
2016----T09:10:04
2016-10-17T-:10:04
2016-10--T09:10:04
2016----T09:10:04

2016-10-17T00:10:04
2016-10-17T09:00:04
2016-10-17T09:10:00

                  please correct me if this notation is wrong in sdtm ISO 8601 fomat?

 



@buddha_d wrote:

Can someone help me with the code to convert this numberic date format to ISO8601 fomat (like17OCT2016 2 time 9:10:04 to 2016-10-17T09:10:04), but I want to have a generic code even for missing date or month or both . I am trying to Converting Non-Imputed Partial Dates for a sdtm dataset. how to delete the wrong numbers for time notation (like hours upto 24, minutes upto 60, upto 60 sec etc) 

eg:

2016-10-17T09:10:04
2016-10--T09:10:04
2016----T09:10:04
2016-10-17T-:10:04
2016-10--T09:10:04
2016----T09:10:04

2016-10-17T00:10:04
2016-10-17T09:00:04
2016-10-17T09:10:00

                  please correct me if this notation is wrong in sdtm ISO 8601 fomat?

 


 

buddha_d
Pyrite | Level 9

Thanks all for your input. 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 6552 views
  • 0 likes
  • 4 in conversation