BookmarkSubscribeRSS Feed
Aswanth
Calcite | Level 5

i want to seperate the date and time and finally i want only time format how can i do..

 

eg;   08SEP09:15:50:02

5 REPLIES 5
ChrisBrooks
Ammonite | Level 13

This should give you what you want

 

data _null_;

	format datebit date9. timebit time.;
	dtime='08SEP09:15:50:02'dt;
	datebit=datepart(dtime);
	timebit=timepart(dtime);
	
	put datebit=;
	put timebit=;
run;
Aswanth
Calcite | Level 5

thank you...chrisbook

how can i convert the time eg...09:30
and this time will be concat to date . if this is correct time format to concat please explain.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

And what format is the data in?  Is it datetime or text?  This is where providing test data in the form of a datastep and what the required output should look like really helps.  If its datetime then use the datepart/timepart functions.  If its text, then use substr and input.

Aswanth
Calcite | Level 5

thank you...Rw9

how can i convert the time eg...09:30
and this time will be concat to date . if this is correct time format to concat please explain.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

I am sorry, I have no idea what you are talking about.  Have a look at some of the other questions posted here for guidance on how to ask a question which provides all the information needed to give an answer, for example:

https://communities.sas.com/t5/Base-SAS-Programming/Getting-max-value-by-group-complex-table/m-p/394...

Note the test data datastep and what the output should look like.

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
  • 5 replies
  • 930 views
  • 0 likes
  • 3 in conversation