SAS

Reply
Occasional Contributor
Posts: 18

SAS

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

 

eg;   08SEP09:15:50:02

Valued Guide
Posts: 595

Re: SAS

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;
Occasional Contributor
Posts: 18

Re: SAS

[ Edited ]
Posted in reply to ChrisBrooks

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.

Super User
Super User
Posts: 9,599

Re: SAS

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.

Occasional Contributor
Posts: 18

Re: SAS

[ Edited ]

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.

Super User
Super User
Posts: 9,599

Re: SAS

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.

Ask a Question
Discussion stats
  • 5 replies
  • 145 views
  • 0 likes
  • 3 in conversation