BookmarkSubscribeRSS Feed
Tourmaline | Level 20

Hello Folks, 


How to copy paste code with colors and format Cntrl+I in university edition?Everytime I pasted the code, I seem to lose the color. Also what's the short cut to format the code like an equivalent to Cntrl+I in Enterprise guide. Any ideas please?

Super User Tom
Super User

I don't think there is any way. One of the prices of building an application to run inside a browser.



Lapis Lazuli | Level 10

SAS University Edition does have a button to format code.  It's to the left of the button to maximize view.  The screen shot below shows the location. 


Format code button is at the top of the program window in SAS University EditionFormat code button is at the top of the program window in SAS University Edition

Calcite | Level 5

but what does it do? 

I'm facing the same problem

Lapis Lazuli | Level 10

The "format code" button can make a program easier to read.  


@ChrisHemedinger wrote a blog post about how you can do this in Enterprise Guide.  


In the screen shot below, I typed a bunch of SAS statements.  While you can write programs this way, it can be difficult for others to read them and understand them quickly.  


Example of messy SAS codeExample of messy SAS codeAfter I press that "format code" button, the program looks like the screen shot below.  Statements are placed on separate lines, some statements are automatically indented, and blank lines are inserted between PROCs, data steps, and comments.  


Nicely formatted SAS codeNicely formatted SAS code

Calcite | Level 5 FNY
Calcite | Level 5

Hi I'm not sure how useful this will be to you since this post like a few years old but hopefully it helps someone else. 

There's a button to copy the SAS Studio code shown in screenshot (where cursor is) and when copied and pasted that way, the color remains.


Calcite | Level 5
Wow, it works! Thank you very much, kind sir. Somehow Copy + Paste doesn't work, but pressing the button "copy code" keeps the format and colors!
Lapis Lazuli | Level 10
Thank you, FNY! It took me some time to find the cursor, but I found it! After selecting a section of code the "cut code" and "copy code" options become active!
Calcite | Level 5

Thank you so much! I was copying code into Google Docs and worrying how much time it would take to format the colors. All I had to do was highlight my code, click the Copy Code button in SAS Studio and paste regularly (Ctrl+V or Cmd+V). Hope this helps others with lots to format!



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 8 in conversation