BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BrahmanandaRao
Lapis Lazuli | Level 10

HI Experts i unable to read below dataset using dateampm

data trians;
input train_name $ 1-22  arrival 23-26  dept 27-32  total_hours 34-39;
informat arrival dateampm dept dateampm total_hours dateampm;
format arrival dateampm dept dateampm total_hours dateampm		;
datalines;
VSKP GARIB RATH(12740)  20:30 04:06 07:36	
GODAVARI EXP(12728)  7:40 01:39 07:59
FALAKNUMA EXP(12704) 15:55 00:02 08:07
;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

@BrahmanandaRao 

I've answered your question on how to read the time strings.

To make everything work: You're posting an input statement which uses list input but the data you post is not on the positions where it should be according to what you've coded. So what's correct now? The data layout or your input statement?

Why don't you give it a go first on your own and then ask more targeted questions when you get stuck.

View solution in original post

3 REPLIES 3
Patrick
Opal | Level 21

There are a few other issues with your code but here how you can read your time strings.

data trains;
  informat arrival dept total_hours time5.;
  format arrival dept total_hours time5.;
  input arrival dept total_hours ;
  datalines;
20:30 04:06 07:36 
;
run;

proc print data=trains;
run;
BrahmanandaRao
Lapis Lazuli | Level 10

Thank you for response

 

But i want output train name including train code

 

 

 

 

Regards,

Anand

Patrick
Opal | Level 21

@BrahmanandaRao 

I've answered your question on how to read the time strings.

To make everything work: You're posting an input statement which uses list input but the data you post is not on the positions where it should be according to what you've coded. So what's correct now? The data layout or your input statement?

Why don't you give it a go first on your own and then ask more targeted questions when you get stuck.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 600 views
  • 0 likes
  • 2 in conversation