## Splitting a hh:mm variable (numeric) in two variables hh and mm

Solved
Occasional Contributor
Posts: 12

# Splitting a hh:mm variable (numeric) in two variables hh and mm

[ Edited ]

Hoping to get some help with this as I have spent hours searching to no avail!

I  have a numerical variable as hh:mm of the type  08:30 (time 5.) and would like to split into two num variables hh and mm so that I can do some recoding.

How does one do that? I have found out about splitting DD/MM/YY:hh:mm but that is not my case as dates are separate.

Hope you can help - thanks so much everyone for reading!

Accepted Solutions
Solution
‎06-07-2017 12:24 AM
Posts: 1,147

## Re: Splitting a hh:mm variable (numeric) in two variables hh and mm

Try the hour and minute functions as below

data want;
set have;
hour=hour(time);
minutes=minute(time);
run;
Thanks,
Jag

All Replies
Solution
‎06-07-2017 12:24 AM
Posts: 1,147

## Re: Splitting a hh:mm variable (numeric) in two variables hh and mm

Try the hour and minute functions as below

data want;
set have;
hour=hour(time);
minutes=minute(time);
run;
Thanks,
Jag
Occasional Contributor
Posts: 12

## Re: Splitting a hh:mm variable (numeric) in two variables hh and mm

Thanks so much - worked perfectly!

Super User
Posts: 13,321

## Re: Splitting a hh:mm variable (numeric) in two variables hh and mm

It might be better to describe (i.e. show a few examples of) the sort of recoding you need. It may be that you do not need two additional variables at all.

☑ This topic is solved.