BookmarkSubscribeRSS Feed
PeterKellberg
Obsidian | Level 7

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

 

 

image.png

16 REPLIES 16
Tom
Super User Tom
Super User

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.

PeterKellberg
Obsidian | Level 7
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.
Ksharp
Super User
table age,sex*f=$sexfmt. ;
ballardw
Super User

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.

PeterKellberg
Obsidian | Level 7

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.

 

Tom
Super User Tom
Super User

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.

PeterKellberg
Obsidian | Level 7
HI Tom, I'm using EG version 7.15. EG 7.12 HF4 does not have this issue.
Tom
Super User Tom
Super User

@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.

CaseySmith
SAS Employee

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


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

PeterKellberg
Obsidian | Level 7

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?

CaseySmith
SAS Employee

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


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

PeterKellberg
Obsidian | Level 7

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

CaseySmith
SAS Employee

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


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

PeterKellberg
Obsidian | Level 7

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 16 replies
  • 2561 views
  • 3 likes
  • 6 in conversation