SAS has only two data types: character strings and numbers.
SAS has tons of formats to display these things per how we need them displayed.
SAS has tons of informats to convert text and binary data into an appropriate character string or number.
You input data with either the input statement or input function (also ninput)
OR you access a data table, either SAS or database, and can then assign or re-assign a format and/or informat to the variable for use within SAS. The association is kept in the SAS dataset header.
Hope this helps your understanding of what you are trying to do.
I think one of the hardest things to do with SAS is figure out what kinds of conversions need to take place. First, I always find it helpful to reiterate the facts about SAS dates and times:
SAS dates and times are just numbers. But when they are stored, internally in the data set, they do NOT look like dates and times. They are numbers which represent an offset from 0. So for dates, 0 is Jan 1, 1960 and 11/15/1950 is 3334 days BEFORE Jan 1, 1960 so the internal number for 11/15/1950 is -3334 (this is the way the date is stored inside the SAS dataset). Today is April 18, 2008 -- that is 17640 days AFTER Jan 1, 1960 so the internally stored value for today's date is 17640. If you display SAS date or time values WITHOUT a format, you will see numbers that do not look like dates or times. But as soon as you use a SAS date or time format on one of these numbers, then SAS knows how to "translate" from the internally stored number and shows you the date or time in a readable, understandable form.
Times work the same way. There are 86400 seconds in a day (24 * 60 * 60). You can see how the seconds add up by running this program:
input desc $ hr min sec;
timeval = hms(hr,min,sec);
begin 0 0 0
firstsec 0 0 1
hour1 1 0 0
three 3 0 0
six 6 0 0
nine 9 0 0
noon 12 0 0
recess 15 0 0
dinner 18 0 0
bedtime 21 0 0
news 22 0 0
lastsec 23 59 59
midnite 24 0 0
proc print data=sastime noobs;
title 'unformatted time values';
And the output from the program is this:
unformatted time values
So, by 6 in the morning, more than 21000 seconds have already gone by. Any single time, measured in HH:MMS for a single day, will have one of these numbers (from 1 to 86400) For 9:01:01, SAS would want to represent that time internally as 32461 (thirty-two thousand, four hundred and sixty one seconds past midnight).
A SAS variable that represents a particular date AND time (as a date/time stamp) represents the number of seconds between January 1, 1960 and an hour/minute/second within a specified date. But since you didn't ask about date/time values, I'll stop with the "facts" here.
Your issue is that you have a number, 90101. You can look at that number and because you know that it represents a time, you can "read" it as a time: 9:01:01 -- but SAS does not know that that number represents a time. SAS can't mentally insert colons between the hours, minutes and seconds, like we can. It only sees a number (ninety thousand one hundred and one). So you have to convert your number.
The reason that Peter's example worked is that he passed a character string to the INPUT function. The most common use of the INPUT function is to turn a character string into a number. INPUT is wonderful at turning character strings that are dates and character strings that are times into the internal SAS number that SAS wants to have to store the dates and/or times.
One way to make your NUMBER, 90101, work with the INPUT function is to turn it into a character string before you pass it to the INPUT function. (This program does that...and shows you how you can turn a 11151950 into a date value, too):
nicknum = 90101;
charval = put(nicknum,z6.);
sastime = input(charval,hhmmss.);