BookmarkSubscribeRSS Feed
td1234
Calcite | Level 5

Can I modify EG so that formatting SAS code doesn't tab "If Then" statements to a seperate lines?

4 REPLIES 4
Jagadishkatam
Amethyst | Level 16
Is the query related to indentation in EG
Thanks,
Jag
td1234
Calcite | Level 5

Yes.

 

I am new to EG.  When  I run the EG code formating procedure, SAS indents the if statement to a seperate line.  For example:

 

I want this:

if x=0 then y=1; else

x >0 then y=2; else

x<0 then y=3;

 

What I get is something like:

 

if x=0 then

            y=1;

else

x >0 then

         y=2;

else

x<0 then

          y=3;

 

 

Jagadishkatam
Amethyst | Level 16
The best way is avoid the formatting in EG and you could simply write and apply no formatting
Thanks,
Jag
Tom
Super User Tom
Super User

Could it have something to do with the code being incorrect?

What is with the extra THEN keywords?

I assume you meant something like this.

if x=0 then y=1; 
else if x>0 then y=2; 
else if x<0 then y=3;

Personally I would not use your style becuase it is placing key information (the ELSE keyword) at the end of the line instead of the beginning of the line. This makes it very difficult to quickly scan the code. The beginning of the lines will be alligned, but the ends of the lines will be ragged.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 4 replies
  • 1021 views
  • 1 like
  • 3 in conversation