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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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