Pages

SyntaxHighlighter

Thursday, August 19, 2021

My Snippets - SQL Snapshot

Now that SAS Studio is becomming more prevalant, I am moving away from Enterprise Guide into SAS Studio. A nice feature of SAS Studio is the ability to add your own code snippets.

While working on a project, I often find myself having to trace thru a multitude of data sets and track the number of rows and columns at each step. I typically keep all those data sets in the WORK library. I have created the below code snippet to support that type of activity.

The steps to save this snippet are to write the SQL statement as shown below then either right mouse click and select "Add to My Snippets" or click on the icon circled in red. Provide a name then click the Save button. Now you can easily recall that code snippet by clicking on Snippets, My Snippets, snap (short for snapshot).

Below is an example output from running the snap snippet. Notice that the output is sorted by the last modified date so it follows the flow of my program.

2 comments:

  1. Thanks for the post, this snippets are always helpful, They are like abbreviation in the desktop SAS

    ReplyDelete
  2. Great post , thanks for sharing.
    While I find this feature handy , I wish the retrieval of the snippets was as easy as creating one. In contrast , SAS eg detects the keystrokes and retrieves a list of snippets from the code editor. Perhaps, that would be added as an enhancement to the SAS studio going forward.

    ReplyDelete