Is there a shortcut to run current code block, without selecting? - sas

Many other IDEs have a feature to run the code block your cursor is placed in. According to the docs, SAS EG has the following shortcut:
Run the selected code -> F3
But is there a shortcut for the following?
Run code block your cursor is placed in -> X
It's tedious to have to constantly reach for the mouse to click-drag-select, then hit F3.
Preemptive thank you from the laziest lizard on earth.

No, there is no shortcut (or way to create such a shortcut). SAS requires you to highlight it.
However, there are some options to make this easier. You can see the SAS EG documentation for some keyboard shortcuts; one option, for example, is to use code folding (Alt + numeric keypad hyphen) to collapse the current data step/proc step/macro, and then you can easily highlight that one line (with shift-end, as it places your cursor at the start of the line).
Also see this question and answer about SAS Enhanced Editor, which has the same basic solution, plus some other ideas.

Related

How to highlight everything up to a certain point

I am new to SAS Enterprise Guide, and I'm beginning to get familiar with some of the useful keyboard shortcuts. I just figured out that Shift+F8 highlights the current step and F8 runs it, but I was wondering if there is a way to set up a shortcut that highlights the current step AND everything before it.
For those of you familiar with RStudio, what I'm looking for is analagous to the "Run all chunks above" option.
Thanks!
I've tried looking at the Macros menu to see if there is an existing option, but I didn't find one.
CTRL+SHIFT+HOME will select everything from a line up to the start of the program

How can I improve the usability/readability of Toad

I have installed Toad 12.8 and I had a pretty big mistake in executing code. I executed code out of sequence, despite triple checking my work. Some how the tab I had selected was unselected and another script was ran. I still wince in embarrassment a week later.
I just wanted to know if there are ways to improve usability/readability of Toad. For instance, can I highlight the tab I have selected? Can I review scripts in a viewer to showcase scripts that I have open and manage which have been executed and not?
I have changed the tab style to 'Flat Buttons', which better showcases the script you are viewing among the many you have open, but thats just 1 small change.
Anyone else have options they like to use? Im not seeing a lot of options here under View Options...
I'm on 12.5. Current tab is highlighted (i.e. has a different color than other tabs). You could, though, change the window background color (by default, it is white).
Open "Configure TOAD options" and search for "TAB", you'll find quite a few options in there.
If you want to review what you've executed, navigate to "Query Viewer" tab in the Editor window. Sort results by "Start Time" in descending order and it'll show what you executed, when, how many time was spent on it, how many rows were affected ... quite useful.
As of running code you didn't mean to: well, what can I say? I'm sorry you did that, but - after all - it is you who should pay attention to what you are doing. No highlighting will solve that problem (also know as we have met the enemy, and it is us).
Something I like to do to is to change the color of TEST vs PROD in order to make them stand out. On the session/new connection window, scroll right and you'll see a "color" column. I set PROD connections to Red and TEST to Blue. Give it a try, maybe you'll like it for a visual reminder for the environment you are working in. It will change the status bar background color so it's not that intrusive.

How to make Vim format C++ code automatically as I type

I have setup clang-format to reformat the current line/selection when I press Ctrl-K in Vim (see the official documentation how to do that). However, it's annoying to be constantly pressing Ctrl-K whenever I edit a line.
Is there a way to make Vim call clang-format as I type or edit code automatically, without me having to press Ctrl-K? In other words, probably after each key stroke in insert mode?
I haven't seen anybody setup vim this way --- what are the potential problems with this setup?

writing SAS code to import .kmf files

I am trying to figure out how to import .kmf files (keyboard macro files) using code in SAS. I have been doing research and have found nothing on the topic. I need to be able to manage updates to several .kmf files across several computers accross several servers. So, doing the usual import is not efficient enough for my needs. Is this even possible in the SAS envoriment? If so where can I find information to help me solve this issue?
According to SAS documents located at http://support.sas.com/kb/19/335.html
The SAS Enhanced Editor allows you to create keyboard macros and
keyboard abbreviations.
To create keyboard macros select Tools >Keyboards Macros.
To create keyboard abbreviations select Tools > Add Abbreviation.
You also have the functionality to export these to a
file and then import them into SAS on another machine.
Note that in order to avoid overwriting any existing keyboard short cut keys, the
key assignments for Keyboard Macros are not exported. You need to
reassign the keys after importing. The Abbreviations do not have key
assignments. To accomplish this do the following: Click Tools >
Keyboard Macros > Macros Hold down the SHIFT key or CTRL key and
left-click to select the abbreviations and macros to export Click on
the EXPORT button and save to a file with the extension .kmf Copy the
file to another machine. Open SAS on the other machine. Click Tools >
Keyboard Macros > Macros. Click the import buttton and select the .kmf
file. For keyboard macros only, click Assign keys and choose a new
shortcut key for each macro.
There is also a SAS Global forum paper that discusses the issues. The specific way to do what you asked for is pasted below. Refer to the entire paper at this link... (http://support.sas.com/resources/papers/proceedings09/073-2009.pdf) for details on the steps using both the editor or EG.
SHARING YOUR ABBREVIATIONS
You might want to share your abbreviations with others, or perhaps you will need to put your >abbreviations on a different computer. This is very easy to do!
EXPORTING ABBREVIATIONS
Place the cursor in the Enhanced Editor window.
Select the Tools menu and then Keyboard Macros, followed by Macros.
A window opens where you select the abbreviations to export.
• If you want to select more than one, hold down the CTRL key on your keyboard as you click on each abbreviation.
• If you would like all of them, click on the first abbreviation in the list, hold down the Shift key, and click on the
last abbreviation. They should all be highlighted. Click on the export button.

How can you "global replace" in Crystal without visual studio?

I had to replace a DB table with embedded SQL in Crystal.
Now I find myself completely amazed that (apparently) I have to open thirty or more formulas one at a time and replace the table name with "Command"
If I select "All formulas" in the replace widget, all the replace controls are disabled.
This is so stupid that I figure I am missing something.
I am working the Crystal files directly in the Crystal IDE. Not able to fire up a C# or VB program to do it for me. I did try a couple of times in the past to edit things in Crystal files with regexp/perl/editors and similar, but that failed due to the Crystal file format.
(S.O. says my question "appears subjective and is likely to be closed." Huh?)
Transitioning from linked tables (Database 'expert') to a command (or the other direction) has always been painful (I've been using the product since v4)--CR doesn't have a good (or even mediocre) way to do this. You should be able to map your command to a single table, but you'll lose field (from the canvas) during the process (because CR will remove unmapped fields). Best practice is to always use a command or to wrap each table.field element in a formula field.
With earlier version of the product, I might have suggested using the SDK to make the change. However, this level of control has been shifted to BusinessObjects' RAS SDK.
If you are interested, have a look at my RptToXml project or its C# replacement.