BookmarkSubscribeRSS Feed
BrahmanandaRao
Lapis Lazuli | Level 10
data retail;
input id date date9. time hh:mm:ss;
format date date9. time hh:mm:ss ;
datalines;
1 18Jun2018 13:25:21
2 28Jun2018 11:33:21
3 29Jun2018 11:24:21
4 29Jun2018 13:25:45
6 21Jun2018 9:59:05
;
run;

Time reading variable error

3 REPLIES 3
ed_sas_member
Meteorite | Level 14

Hi @BrahmanandaRao 

 

As mentioned by @Kurt_Bremser, this is not a valide format.

You can use ":informat." in the input statement to specify how to interpret input values, and then specify the format for display :

data retail;
input id date:date9. time:time8.;
format date date9. time time8. ;
datalines;
1 18Jun2018 13:25:21
2 28Jun2018 11:33:21
3 29Jun2018 11:24:21
4 29Jun2018 13:25:45
6 21Jun2018 9:59:05
;
run;

Capture d’écran 2020-02-23 à 10.32.33.png

-> You can see that SAS reads correctly the date and the time variables.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 712 views
  • 1 like
  • 3 in conversation