Desktop productivity for business analysts and programmers

FORMAT stmt in red

Reply
Occasional Contributor
Posts: 18

FORMAT stmt in red

Why in heavens name is the FORMAT statement red in this code (EG version 7.15)?

 

 

image.png

Super User
Super User
Posts: 8,275

Re: FORMAT stmt in red

Posted in reply to PeterKellberg

That is easy. The EDITOR does not really understand SAS code. It is just an editor.

 

They have programmed it with some rules that approximate how SAS might interpret the code.  That way it can give some color coded HINTS about the meaning of what you have typed.  But it really has no idea that SAS code is any different than your mother's meatloaf recipe.

Occasional Contributor
Posts: 18

Re: FORMAT stmt in red

Well I dont quite agree: The editor should make keywords blue - all of them - just like in the Enhanced Editor in SAS Classic or whatever it is called. It's not just an editor. It's the SAS Programming Language editor in Enterprise Guide.And as such I expect a professional tool.
Super User
Posts: 10,849

Re: FORMAT stmt in red

Posted in reply to PeterKellberg
table age,sex*f=$sexfmt. ;
Super User
Posts: 13,937

Re: FORMAT stmt in red

Posted in reply to PeterKellberg

Personally I would delete everything between the ; on the Proc Tabulate statement and the F in format.

I suspect an invisible character OR something way out to the right on the Proc Tabulate statement that doesn't appear in your snippet.

 

 

Of course just to create a "stumper" someone could have customized the keyword lists and applied a non-default color scheme for custom keywords.

Occasional Contributor
Posts: 18

Re: FORMAT stmt in red

I appreciate all your suggestions ;-) Sorry to say that are absolutely no hocus pocus in the code. No invisible characters whatsoever.

Just write the few lines and see what happens. The red color is annoying. it simply attracts unnecessary attention. FORMAT is valid statement.

 

Super User
Super User
Posts: 8,275

Re: FORMAT stmt in red

[ Edited ]
Posted in reply to PeterKellberg

Most likely it is not seeing the PROC statement as valid.

If I open EG 7.13 and start a new program file with:

proc tabulate ;
  format xxx ;
run;

Then is does not make the FORMAT keyword red.

But if hide the PROC statement then it does since you cannot have a FORMAT statement outside of a DATA or PROC step.

*proc tabulate ;
  format xxx ;
run;

image.png

So in this case it looks like EG editor is better at highlighting programs than the Enhanced Editor in Display Manage of SAS 9.4.

image.png

You need to look at the code above the PROC TABULATE statement to see what is confusing the editor.  

Perhaps your code is in the middle of a macro definition?  Or perhaps you actually do have an open comment like in my example?

Or perhaps something changed from 7.13 to 7.15?  Open a SAS support ticket.

Occasional Contributor
Posts: 18

Re: FORMAT stmt in red

HI Tom, I'm using EG version 7.15. EG 7.12 HF4 does not have this issue.
Super User
Super User
Posts: 8,275

Re: FORMAT stmt in red

Posted in reply to PeterKellberg

PeterKellberg wrote:
HI Tom, I'm using EG version 7.15. EG 7.12 HF4 does not have this issue.

Open a ticket with SAS support.

The issue might not be with the FORMAT statement, but with something in the first 6 lines that it is now processing differently that it changing the state.

SAS Super FREQ
Posts: 401

Re: FORMAT stmt in red

[ Edited ]

I typed the exact code you posted into a new program in EG 7.15 and I don't see the issue (red "format" statement).  If you post some code that can be pasted into a new program in EG 7.15 to reproduce, I'll be happy to investigate.

 

I agree with Tom, something in the prior code may be contributing.

 

Casey

Occasional Contributor
Posts: 18

Re: FORMAT stmt in red

Posted in reply to CaseySmith

Hi Casey, That's odd - should be the same. Actually it was one of my "customers" here in Statistics Denmark who notified me that his FORMAT statements now showed up in red in EG 7.15. And I was able to reproduce it with a simple code snippet.

 

In my Enhanced Editor Settings (tools, options, SAS Programs, Enhanced Editor Options, Appearance) undefined keywords are red. I guess this is the standard. Could you be so kind to check your setting?

SAS Super FREQ
Posts: 401

Re: FORMAT stmt in red

[ Edited ]
Posted in reply to PeterKellberg

Hi Peter,

 

I confirmed my editor option to color undefined keywords red (the default) is set.  Also if I rename "format" to something incorrect like "forwat", it is properly colored red.

 

If you type (or copy/paste) this into a new program in EG 7.15, do you see the problem?

 

proc tabulate data=sashelp.class;
    format sex $sexfmt.;
    class age sex;
    table age, sex;
run;

 

If so, that is odd.  (I'm not sure what would explain the difference we are seeing.)  Perhaps we have other different options set.  Or maybe a regional difference.  Are you running EG in English?  What locale is your Windows Regional Settings set to?

 

Casey

Occasional Contributor
Posts: 18

Re: FORMAT stmt in red

Posted in reply to CaseySmith

Hi Casey,

 

If I either write or copy/paste your code FORMAT gets red... EG is in English. Regional settings on the terminal server that runs EG is

 

NLS_DATE_FORMAT=DD-MON-RRRR
NLS_LANG=DANISH_DENMARK.WE8MSWIN1252

 

Well I will send the issue to SAS Tech Support, Copenhagen and see if they can reproduce it. Its not a big deal - just annoying.

 

Thx to all of you Fellow SAS Champions ;-)

 

Regards,

 

Peter

SAS Super FREQ
Posts: 401

Re: FORMAT stmt in red

Posted in reply to PeterKellberg

Thanks for trying that out Peter.  Yeah, Tech Support is probably the best route, so we can track it in our system.  If we find a way to reproduce, we'll certainly investigate.

 

Casey

Occasional Contributor
Posts: 18

Re: FORMAT stmt in red

Posted in reply to CaseySmith

Hi all,

 

UPDATE: SAS Technical Support Copenhagen, Denmark has just informed me that Global Support was able to reproduce the problem - defect S1378007. It will be taken care of in a future Hotfix for EG 7.15.

 

 

Regards,

 

Peter

Ask a Question
Discussion stats
  • 15 replies
  • 496 views
  • 2 likes
  • 5 in conversation