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