BookmarkSubscribeRSS Feed
Yuliya
Obsidian | Level 7

Hi everyone,

 

First, I would like to wish everyone Happy Easter and thank you for your help.

 

Now, the question: I have a dataset from insulin's pumpa when a patient measures blood suger at very different time periods. Thus, for a TIME variable I have a string which looks like this  2015-07-20 07:59. 

 

I wonder how I can format this string to be able to work with time series?

 

Thank you in advance for any advice.

 

Regards,

 

Yuliya

2 REPLIES 2
Reeza
Super User

You need to convert your string to a SAS date for starters, the INPUT function can do this. Depending on your data it may also be possible to change it earlier, ie if you are reading it from a text file its worth fixing it in that stage. 

 

Date_var = input(string_var, anydtdtm.);
Format date_var datetime21.;
Yuliya
Obsidian | Level 7

Hi Reeza,

 

thank you very much for your reply. Actually, I used your advice and change the format beforehand, now it is ok. But it is useful to know how INPUT works as well, I have never used it before, thank you.

 

Now I have other questions but I will post them under other title.

 

Have a nice day.

 

Regards,

 

Yuliya

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 701 views
  • 1 like
  • 2 in conversation