BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
fengyuwuzu
Pyrite | Level 9
data WORK.Time    ;
      infile 'Data.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;
          format StartTime datetime. ;
          format ClosingTime datetime. ;
      input
            ID $12.
            StartTime :YMDDTTM.
            ClosingTime :YMDDTTM.
            Fee 
            time=INTCK('minute',ClosingTime,StartTime);
run;

 

I tried to use the above code to input two time variables and calculate the interval between them. The time format was like 

2014-01-01 02:56:37 and after reading into SAS, it is like 01JAN14:02:56:37 

 

when I use

time=INTCK('minute',ClosingTime,StartTime);

but the INTCK function gave error:

ERROR 22-322: Syntax error, expecting one of the following: a name, arrayname, _ALL_, _CHARACTER_,
              _CHAR_, _NUMERIC_.

ERROR 76-322: Syntax error, statement will be ignored.

 

when I use   

   time = ClosingTime-StartTime;

RROR: Missing numeric suffix on a numbered variable list (ClosingTime-StartTime).

 

any hints?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Are you missing the semicolon at the end of the INPUT statement?

View solution in original post

2 REPLIES 2
Astounding
PROC Star

Are you missing the semicolon at the end of the INPUT statement?

fengyuwuzu
Pyrite | Level 9

yes. thanks.
this solved the problem.

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
  • 2 replies
  • 909 views
  • 0 likes
  • 2 in conversation