BookmarkSubscribeRSS Feed
dk333
Calcite | Level 5

Is there a way to introduce a carriage return in the SAS 9.4 Program editor or Enhanced Program Editor?  I am writing a long documentation note for a program.  When I type, there is no automatic carriage return to the beginning of the line below.  I need to press "enter" to get the cursor to go to the next line.  Is there any way that SAS can roll the text over to the line below after a specified number of characters without me having to press the enter key?  Thanks.

4 REPLIES 4
ballardw
Super User

The Program Editor: Open the editor, menu select Tools>Options>Program Editor.

Go to the Autoflow tab.

Click on the box AutoFlow Inserted Text

May want to set the BOUNDS below that to a reasonable line length such as 80 or so. Otherwise the lines may default to I think 136 characters.

 

Don't think there is any autoflow equivalent for the Enhanced Program Editor

dk333
Calcite | Level 5

Thank you!

Tom
Super User Tom
Super User

The old program editor had a nice flow command you could use by entering command into the line number area.  But it has been broken for awhile.  It used to stop when it hit a blank line. Now it flows the whole file.  But it will still work as long as the text you want to flow is at the end of the program.

Tom_1-1720459959657.png

Tom_2-1720459993473.png

The "enhanced" editor did not include that feature (or any of the other useful line number commands).

 

You could pretty easily mimic that by running a data step to dump the flowed text to the LOG and then just copy and paste it back into your program.

data _null_;
  file log column=cc ;
  input word :$200. @@ ;
  if length(word)+cc > 70 then put;
  put word @;
cards4;
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam nunc quam, scelerisque laoreet dignissim a, sodales et lectus. In suscipit et neque id pulvinar. In dignissim, eros non viverra faucibus, dolor mi mollis justo, eget pulvinar tortor risus eget
Praesent pharetra nisi eget nisi aliquam euismod. Sed porta molestie lacinia. Nam nec ex sed neque rutrum sagittis sit amet ac velit. Etiam sagittis eros est, id tincidunt urna tempus ut. Sed a sodales dui. Duis eu quam sapien. Donec ut est justo. In in te
lor ac ligula vestibulum dapibus.
;;;;

Result:

2054  data _null_;
2055    file log column=cc ;
2056    input word :$200. @@ ;
2057    if length(word)+cc > 70 then put;
2058    put word @;
2059  cards4;

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam nunc
quam, scelerisque laoreet dignissim a, sodales et lectus. In suscipit
et neque id pulvinar. In dignissim, eros non viverra faucibus, dolor
mi mollis justo, eget pulvinar tortor risus eget velit. In viverra
risus vitae sapien consequat, id tempor purus mollis. In ultrices
felis massa, a volutpat leo ullamcorper at. Praesent pharetra nisi
eget nisi aliquam euismod. Sed porta molestie lacinia. Nam nec ex sed
neque rutrum sagittis sit amet ac velit. Etiam sagittis eros est, id
tincidunt urna tempus ut. Sed a sodales dui. Duis eu quam sapien.
Donec ut est justo. In in tellus fringilla tortor pretium
sollicitudin vel eu ligula. Duis mattis fermentum nibh, vel accumsan
quam aliquam et. Nulla nec do lor ac ligula vestibulum dapibus.
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

2063  ;;;;
dk333
Calcite | Level 5

Thank you for the thoughtful response.  I appreciate it.  The problem, though, is that I would still need to manually press enter at the end of every line when I'm creating the note to keep the line from flowing interminably off to the right of the screen.  I'm looking for something that can work while I'm creating the note, not after I've created the note.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 4 replies
  • 384 views
  • 1 like
  • 3 in conversation