DATA Step, Macro, Functions and more

How to enter TIME format via DI Studio

Reply
Contributor
Posts: 51

How to enter TIME format via DI Studio

Hi there,

I am trying to enter a time8. format into a SAS dataset via edit mode in DI studio.

However, the system keeps on complaining about a wrong format unless I build a job to table-load an existing time8. value from another table into my target table.

Copy/Pasting exactly this value from the source does also not work.

How do I need to enter the time into a time8. cell?

Not working is:
- 1960-01-01 18:00:00
- 18:00:00

Thanks a lot and regards,
Thomas
SAS Super FREQ
Posts: 8,743

Re: How to enter TIME format via DI Studio

Hi:
There are 2 different concepts in regards to SAS Date/Time values:
1) How the number is DISPLAYed (using a SAS FORMAT) and,
2) how the number is INPUT -- if you are using SAS to perform data entry or reading data INTO a SAS dataset, then you must use a SAS INFORMAT.

What can be confusing is that the names of the FORMATs and INFORMATs can be the same. And just because you have a SAS FORMAT for display does not mean that you have a SAS INFORMAT for entering data via SAS.

Suppose for, example, that a person's birthdate is Nov 15, 1950. The "internal" value for that SAS date value is -3334. I can DISPLAY that number with the date9. FORMAT and then the DISPLAYed valued would be: 15NOV1950. If I wanted to perform data entry into a SAS dataset, without an INFORMAT, I would have to enter that date as -3334. If I had an INFORMAT of MMDDYY10., then I could type 11/15/1950 into a cell. If I had an INFORMAT of DATE9., then I could type 15NOV1950 into the cell.

Most times, folks don't worry about setting an INFORMAT because they're not doing "data entry" or they're not reading "raw data" into SAS such that they need an INFORMAT. However, you might check your table settings to make sure that both a FORMAT and an INFORMAT have been set for your dataset.

If you need more help using DIStudio or setting INFORMATS, you might consider contacting Tech Support.

cynthia
Contributor
Posts: 51

Re: How to enter TIME format via DI Studio

Hi Cynthia,

thanks - of course the informat is set. In this case, as stated, it's TIME8. However, I am not able to enter 18:00:00, 18.00.00, 1960-01-01 18:00:00...and looking for the correct way to enter it.

Rgds,
Thomas
Super User
Posts: 5,256

Re: How to enter TIME format via DI Studio

I reproduced your problem, and it seems like a bug to me. My Time8. formatted fiels are displayed as a datetime value, and it does not accept any time or datetime values I tried out. I suggest that you report this to tech support.

Linus
Data never sleeps
SAS Super FREQ
Posts: 8,743

Re: How to enter TIME format via DI Studio

I agree with Linus. If you have both an INFORMAT and a FORMAT set for the variable then this is an issue for Tech Support.

cynthia
Ask a Question
Discussion stats
  • 4 replies
  • 130 views
  • 0 likes
  • 3 in conversation