BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Babloo
Rhodochrosite | Level 12

I'm not certain where I'm missing the closed paranthesis in the below code.

 

26         data test;
27         
28         SCHDLD_OBJ_RUN_STRT_TMST=%sysfunc(floor(%sysfunc(inputn("&etls_stepStartTime",datetime17.)))/60*60);
                                                                                                             _
                                                                                                             388
                                                                                                             200
                                                                                                             76
ERROR: Expected close parenthesis after macro function invocation not found.
ERROR 388-185: Expecting an arithmetic operator.

ERROR 200-322: The symbol is not recognized and will be ignored.

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

29         format SCHDLD_OBJ_RUN_STRT_TMST dtfmt.;
30         run;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.TEST may be incomplete.  When this step was stopped there were 0 observations and 1 variables.
WARNING: Data set WORK.TEST was not replaced because this step was stopped
1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

You are doing a simple assignment in a data step, so the %sysfunc's are unnecessary.

SCHDLD_OBJ_RUN_STRT_TMST = floor(input("&etls_stepStartTime",datetime17.) / 60) * 60;

You need to take more care when copying code suggested by people here. Note that I moved the multiplication out of the floor() call.

 

Edited to use input instead of inputn, kudos to @Astounding 

View solution in original post

11 REPLIES 11
Kurt_Bremser
Super User

You are doing a simple assignment in a data step, so the %sysfunc's are unnecessary.

SCHDLD_OBJ_RUN_STRT_TMST = floor(input("&etls_stepStartTime",datetime17.) / 60) * 60;

You need to take more care when copying code suggested by people here. Note that I moved the multiplication out of the floor() call.

 

Edited to use input instead of inputn, kudos to @Astounding 

Astounding
PROC Star
Advice:

Get rid of %sysfunc, then change INPUTN to INPUT. DATA steps know how to use functions and don't need macro language to perform the calculations.

Once you do this, the code becomes much easier to write, interpret, and debug.

Expect debugging to be needed since

value / 60 * 60

is equal to

value

Good to see that you are trying to run tests to get this to work.
ballardw
Super User

If you are using the SAS Display Manager (sometimes called Base) interface the enhanced editor has a "find matching parentheses" ability. Place the cursor on a ( , ) , [ , ] , { or } character in the code. Press either CTRL 9 or CTRL 0  (note those are the keys with the ( and ) symbol) or Ctrl [ or Ctrl ] and the editor will show what SAS is currently interpreting to be the matching character.

 

Note that I did say interpreting, not what you intend.

 

If the cursor doesn't move then there is no match found by the SAS interpretation rules. So you can go to the last ) and find out which one is the "match". That should give a hint where to start looking for syntax issues.

 

 

Quentin
Super User

I never knew enhanced editor did parenthesis matching.  Looks like the key combination is: CTRL [      i.e. Ctrl key and the bracket key.

 

https://v8doc.sas.com/sashtml/win/zenhcded.htm

 

I was trying CTRL ( by holding down SHIFT CTRL and number 9 at the same time , but didn't have any luck. : )

 

ballardw
Super User

@Quentin wrote:

I never knew enhanced editor did parenthesis matching.  Looks like the key combination is: CTRL [      i.e. Ctrl key and the bracket key.

 

https://v8doc.sas.com/sashtml/win/zenhcded.htm

 

I was trying CTRL ( by holding down SHIFT CTRL and number 9 at the same time , but didn't have any luck. : )

 


Miss typed corrected now

 

This can be changed in the Enhanced Editor Preferences: Tools>Options>Enhanced Editor Keys. Select Navigation in the top drop down list. Scroll down to Move cursor to matching brace. The list shows

Ctrl+[

Ctrl+]

Ctrl+0

Ctrl+9

as the default defined keys.

Quentin
Super User

Nice, never noticed that. I wish there was a "move cursor to end|beginning of step."  That would make it easy to submit the current step where the cursor is located.

 

Feels like the kind of thing @rogerjdeangelis is likely have working (though perhaps only in the non-enhanced editor)?

 

Babloo
Rhodochrosite | Level 12

I'm using SAS EG 7.15, seems enhance Editor facility is not available in EG.

Quentin
Super User

Enhanced editor is an old PC SAS thing (introduced in v7 I think?).  It was enhanced over an even older PC SAS editor window.   It brought amazing things to your SAS code, like colors.

 

EG program editor has just about all the benefits of the enhanced editor and more.  For example, parenthesis matching in EG is automatic.  When you type a close parenthesis, it highlights the opening parenthesis it matches with.  And you can also move the cursor through an expression, and each time it hits a parenthesis, it will highlight the pair.

 

paren.png

 

 

Babloo
Rhodochrosite | Level 12
Should I change any options in EG to experience this feature? If I type
close paranthesis ')' I couldn't see that program editor is matching the
open parentheses.
Quentin
Super User

I don't think you need to turn any option on for parenthesis matching. 

 

I checked Tools->Options->SAS prgorams->Editor Options and didn't see anything obvious.

 

I'm in EG 7.15 also, and EG has done parenthesis matching as long as I can remember.  Maybe ask over in the EG community.

FreelanceReinh
Jade | Level 19

Hi @Babloo,

 

On the "Appearance" tab in the "Enhanced Editor Options" window (see Quentin's post) there is an item "Parenthesis match highlighting" in the box "File elements." There you can change the "Background" color for that highlighting ("Gray" in the "Default" scheme). If this is set to an inappropriate color (e.g. white on white background or a color that is invisible for some reason on your screen), then, indeed, you won't see the highlighting.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 11 replies
  • 3818 views
  • 9 likes
  • 6 in conversation