BookmarkSubscribeRSS Feed
ThomasH
Calcite | Level 5
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
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
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
ThomasH
Calcite | Level 5
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
LinusH
Tourmaline | Level 20
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
Cynthia_sas
SAS Super FREQ
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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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