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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 651 views
  • 1 like
  • 3 in conversation