1 / 30

Using the SAS Enhanced Editor

Rob Krajcik Bristol-Myers Squibb. Using the SAS Enhanced Editor. Topics. Why use the Enhanced Editor? Editor Options Window Two Sets of Keys Opening Files Multiple Views Editor Line Commands Explorer Window Context-Sensitive Help Viewtable Window Selecting Text Drag and Drop Editing

kalista
Télécharger la présentation

Using the SAS Enhanced Editor

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Rob Krajcik Bristol-Myers Squibb Using the SAS Enhanced Editor Hartford Area SAS Users Group

  2. Topics • Why use the Enhanced Editor? • Editor Options Window • Two Sets of Keys • Opening Files • Multiple Views • Editor Line Commands • Explorer Window • Context-Sensitive Help • Viewtable Window • Selecting Text • Drag and Drop Editing • DM Key Customization • Toolbar Customization • Other Customizations • Keyboard Shortcuts • Abbreviations • Keyboard Macros • New Environment Variables

  3. Why Use the Enhanced Editor? • Colorizes program elements, quoted strings,and comments; easy to spot typos, missing quotes, semi-colons, run-on comments, and do-end blocks • View the high-level flow of your program • Extensible – add keys and toolbar icons • Allows multiple instances (edit windows) • Allows multiple views of the same file • Can bookmark lines for easy access • Drag and drop editing • View->My Favorite Folders (Explorer) • Context-sensitive help • Customize keyboard shortcuts • Abbreviations & Macros

  4. Editor Options WindowTools -->Options -->Enhanced Editor

  5. Two Sets of Keys Tools --> Options --> Enhanced Editor Keys

  6. Opening Files • Click on the FILEOPEN toolbar button • Type FILEOPEN (or DLGOPEN) on the command line • Click on File->Open Program on the menu • Click on File->Open Object on menu (SCL) • Type INC “<.\>name.sas” on the command line • Type WEDIT “<.\>name<.sas>” on the command line • Type FILEOPEN “<.\>name<.sas>” on the command line • Type WHOSTEDIT ENTRY=“libname.catname.name.source” (SCL) • Drag the .sas program from the explorer window and hold it on the SAS icon – an enhanced editor window will open

  7. Multiple Views Window -->New Windowand arrange them anyway you like. Changes to one will bereflected in the other(s)

  8. SAS Text Editor Line Commands These commands can be executed by typing in the numbered part (sequential numbers) of the display and pressing ENTER. Follow line commands that have a numeric argument with a space before issuing them. C,CC -- Copy CL, CU, CCL, CCU -- Case L (U) COLS -- Show columns D,DD -- Delete I,IA,IB -- Insert JC, JL, JR, JJC, JJL, JJR -- Justify M,MM -- Move MCL,MCU -- Case L (U) Marked MASK -- Define initial contents of a line R,RR -- Repeat TC,TF,TS -- Text Connect (Flow) (Split) TABS -- Show Tabs >, >>, ), )) -- Shift right <, <<, (, (( -- Shift left SAS Enhanced Editor Line Commands These commands can be executed by selecting a line number (CTRL-G, for example) and typing the command in the command bar. :In, IAn – Insert n lines after the current line. :IBn – Insert n lines before the current line. :Dn – Delete n lines starting at the current line. :Rn m – Repeat the block of m lines, starting with the current line, n times. A space is required between n and m. Editor Line Commands

  9. Explorer Window In SAS 9.1, There is a link to "My Computer" as well as Libraries and File Shortcuts!

  10. Place cursor on, or select, a a dark blue section of codeand hit F1 Context-Sensitive Help

  11. Viewtable Window

  12. Click and Hold LMB Press Shift and a directional key Can Submit / Rsubmitselected text Can Also upcase / lowcase selected text CTRL+SHIFT+LCTRL+SHIFT+U Selecting Text

  13. Hold the CTRL buttonwhile dragging selection. Drag and Drop Editing

  14. DM Key Customization data_null_; if resolve('&sysprocessname') = 'DMS Process' thendo; /* Program Function Key modifications */ call execute("dm wedit 'Keydef ''CTL Y'' title' wedit;"); call execute("dm wedit 'Keydef ''CTL T'' paste' wedit;"); call execute("dm wedit 'Keydef ''CTL H'' ~ ' wedit;"); call execute("dm wedit 'Keydef ''CTL F11'' cle log ' wedit;"); call execute("dm wedit 'Keydef ''CTL F12'' cle out ' wedit;"); call execute("dm wedit 'Keydef ''SHF F2'' vt _last_;edit ' wedit;"); call execute("dm wedit 'Keydef ''SHF F9'' gsub buf=default ' wedit;"); call execute("dm wedit 'Keydef ''SHF F11'' dlgopen ' wedit;"); call execute("dm wedit 'Keydef ''SHF F12'' dlgsave ' wedit;"); /* Save dmkeys and toolbox customizations to local catalog */ call execute('libname here ".";'); call execute('proc catalog cat=here.profile;'); call execute(' copy out=sasuser.profile;'); call execute(' select dmkeys /et=keys; '); call execute(' select sasedit_main / et=toolbox;'); call execute('quit;'); call execute('libname here;'); end; stop; run;

  15. Note: Gsubmit macro in quotes Toolbar CustomizationTools --> Customize

  16. Other Customizations • Get SCL Source files to open in Enhanced Editor instead of NOTEPAD (From a SAS-L post). • To use the enhanced editor for SCL entries, bring up the SAS Registry (issue the REGEDIT command or go to Solutions -> Accessories -> Registry Editor). Expand Products -> AF -> Design Time -> Source Window. Right click on EnhancedEditor -> Modify and change value to Yes. • Tools -> Options -> Explorer. Select "catalog entries" from the combobox, scroll down to SOURCE and double click. • Change NOTEPAD %8B.%32B.%32B.%8Bto: WHOSTEDIT ENTRY="%8B.%32B.%32B.%8B"

  17. Some Keyboard Shortcuts Alt + [ , Alt + ] Move cursor to matching DO/END keyword Alt + Down Move cursor to the last visible line Alt + F8 Play a command/macro Alt + Shift + R Start/Complete macro Alt + Up Move cursor to the first visible line Ctrl + / Comment the selection with line comments Ctrl + A Select all Ctrl + Backspace Delete to previous word start Ctrl + C Copy selection Ctrl + Delete Delete to next word start Ctrl + Down Scroll screen up Ctrl + F Find (interactive) Ctrl + F2 Toggle marker on the current line (bookmark) Ctrl + G Go to line (interactive) Ctrl + H Replace (interactive) Ctrl + Page Down Move cursor to the bottom of the file Ctrl + Page Up Move cursor to the top of the file Ctrl + Shift + / Undo the Comment Ctrl + Shift + A Add a new abbreviation Ctrl + Shift + L Convert the selected text to lowercase Ctrl + Shift + M Add or change macros Ctrl + Shift + U Convert the selected text to uppercase Ctrl + Shift + W Clean up whitespace Ctrl + V Paste from clipboard Ctrl + X Cut selection Ctrl + Y Redo Ctrl + Z Undo

  18. CTRL+G Keyboard Shortcuts – CTRL+G

  19. Keyboard Shortcuts – CTRL+F2

  20. Keyboard Shortcuts – CTRL+F (dlgfind)

  21. Keyboard Shortcuts – CTRL+H (dlgreplace)

  22. in Editor Window, Hit CTRL+A & CTRL+C | CTRL+X Tools->Add Abbreviation -or- CTRL+SHIFT+A Name it, and then hit CTRL+V in the Text Box Abbreviations - Creating

  23. Type in the word “signon”... And then hit the TAB | ENTER key Abbreviations - Using

  24. Tools->Keyboard Macros->Record New Macro -or- ALT+Shift+R. Start Typing. When Done, Tools->Keyboard Macros->Stop Recording -or- ALT+Shift+R. Keyboard Macros - Recording

  25. Fill out Save Keyboard Macro and Click Assign Keys. Next, enter a shortcut Key (like CTRL+F5) and Click Assign, and OK. Keyboard Macros - Saving

  26. Tools->Keyboard Macros->Macros-or- CTRL+Shift+M Click Export, and Save as a Keyboard Macro File. Keyboard Macros - Maintenance

  27. Tools->Keyboard Macros->Macros-or- CTRL+Shift+M Now click on Assign Keys and (optionally) Edit to add description. Your Abbreviation is now a Macro. From Abbreviation To Keyboard Macro

  28. New Environment Variables 155 dm wedit 'file shoe_report.sas' wedit; 156 proc report nowd data=sashelp.shoes(obs=10); 157 run; NOTE: There were 10 observations read from the data set SASHELP.SHOES. NOTE: PROCEDURE REPORT used (Total process time): real time 0.00 seconds cpu time 0.01 seconds 158 %put Sysprocessname is &sysprocessname; Sysprocessname is DMS Process 159 %put Submitted File Path is %sysget(SAS_EXECFILEPATH); Submitted File Path is C:\Documents and Settings\krajcikr\shoe_report.sas 160 %put Submitted File Name is %sysget(SAS_EXECFILENAME); Submitted File Name is shoe_report.sas Environment VariablesSAS_EXECFILEPATH andSAS_EXECFILENAME areNew with Version 9.1

  29. Questions?

  30. References: • Paul Grant, “Creating Code Templates in the SAS Enhanced Editor Using Abbreviations and User Defined Keywords”, Sep 2002 BASUG, http://www.basug.org/downloads/0303_saseditor.pdf • Arthur L Carpenter, “Creating Display Manager Abbreviations and Keyboard Macros for the Enhanced Editor” SUGI 28 Proceedings, http://www2.sas.com/proceedings/sugi28/108-28.pdf • SAS Institute, Inc. “SAS 9.1 Companion for Windows”, http://support.sas.com/documentation/onlinedoc/91pdf/index_912.html

More Related