Tips for SAS programming with PSPad

From sasCommunity

Jump to: navigation, search

Contents

[edit] PSPad

PSPad is a freeware text editor available at http://www.pspad.com/en/. PSPad has a number of useful features such as search/replace using regular expressions, search/replace in files, selection of rectangular data, scripting. Some nice features:

  • Using find, you can get a list of all occurrences of a string. Double-click on a list item to go to the line where it occurs.
  • Matching parentheses, braces, brackets are highlighted.
  • Use Ctrl-Alt-d to insert the date.
  • Use "Tools", "Expression evaluator" to do some quick math
  • Use "Edit", "Lines Manipulation", "Join lines" to, well, join lines.
  • Use "Format", "Block Format", "Reformat" to break long lines into short ones
  • Use Alt-left to set a bookmark, alt-right to remove a bookmark, and alt-up or alt-down to jump between bookmarks

[edit] Batch processing

Select "Settings", "Highlighter Settings ...", then select the "External Applications" tab. Enter a suitable name in the "Name" field and the following text in the "Application field":

"C:\Program Files\SAS\SAS 9.1\sas.exe" "%File%""

[edit] Open file in SAS

Follow the steps for batch processing but enter the following text in the "Application field":

"C:\Program Files\SAS\SAS 9.1\sas.exe" -sasinitialfolder "%Dir%" -initstmt 'dm editor "include  ""%File%""; zoom on" wedit continue;' -EEFILECHANGEUPDATES

This will open a file in SAS with windows maximized. Delete the "zoom on" option if you don't want maximized windows. The "-EEFILECHANGEUPDATES" option means that files can be editted by PSPad and that changes will appear in SAS.

[edit] SAS Help

Select "Settings", Highlighter Settings ...", then select the "Specification" tab. Enter "C:\Program Files\SAS\SAS 9.1\core\help\common.chm" in the "Help file" field. Now you can open the SAS help file by pressing Alt-F1 (if you're editting a SAS file).

[edit] Usefull Add-ons

Many useful scripts and other extensions are availabe at http://www.pspad.com/en/pspad-extensions.php. Two SAS specific add-ons are available in this zipfile. SAS.INI is configuration file for syntax coloring similar to the Enhanced Editor. InsertSAScomments.vbs is a script file for inserting and deleting SAS comments. See the Readme.txt file for details on where to place these files.

Personal tools