- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello all!
Is there a way to tab a selected block of code?
For Example, I want this:
Data temp;
do i =1 to 10;
if i=2;then j=5;
else if i =3 then j=1;
else j=3;
end;run;
to be this in one keyboard command after selecting the code:
Data temp;
do i =1 to 10;
if i=2;then j=5;
else if i =3 then j=1;
else j=3;
end;run;
Thank you! And sorry if this question has already been posted. And if you know the answer, can you also tell me how to go backwards?
-Victor
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Are you asking about indenting the code or storing it for later recall?
I would expect that if you highlight to select lines and then press the tabl key it should indent.
And what do you mean by "go backwards?" If you mean to reverse indent then select lines and use shift+tab keys.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Are you asking about indenting the code or storing it for later recall?
I would expect that if you highlight to select lines and then press the tabl key it should indent.
And what do you mean by "go backwards?" If you mean to reverse indent then select lines and use shift+tab keys.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you so much! Yes, just simply indenting the code. Sorry, the answer was so obvious.
How would you store the code for later recall though?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Storing code would depend on which way you are using SAS, base, Enterprise Guide or Studio.
In base SAS you can store "abbreviations". From the Editor select the text, go to the Tools menu and select Add Abbreviation. Enter a name for the abbreviation in the top box and then paste the code into the box labeled Text to insert for abbreviation. The "name" typed into the box becomes a prompt that when typed allows you to accept the abbreviation into the editor. So it makes sense to use an uncommon combination of keys to start the "name". I use things like #t. I recommend not using % or & due to use in macros.
You can also generate keyboard macro code to instert characters (which ends up much like the abbreviation in execution).
SAS Studio uses "snippets" but I don't use Studio so I can't supply details.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
THIS IS AWESOME!!
Thank you so much. The abbreviations will be incredibily helpful and fun. What do you mean by generate keyboard macro code to insert characters though? Can you provide a small example for me?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I suggest using the menues avaiable from Tools -> Keyboard Macros and experimenting.
You can record a series of operations, you can do a large number of things in the editor related to searching, selection, insertion, code formatting (make sure you don't do this with a critical code file without making a copy. You only have to sort a code file once to find out that order is very hard to recover if not careful).
Some actions make more sense for selected (highlighted code), such as the mentioned sort, some navigate through the file, some do things with line markers that are not part of the file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The tool to ident a group of lines depends on the SAS environment.
Assuming you are not working on MF, try to select the wanted lines by the left mouse button
and then click on TAB to indent th elines to the right, or click Shift-TAB to indent to the left.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content