As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Tips for SAS programming with PSPad

From sasCommunity
Jump to: navigation, search

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

This PDF file contains more information on using PSPad with SAS.

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%""

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.

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).

Usefull Add-ons

Many useful scripts and other extensions are availabe at http://www.pspad.com/en/pspad-extensions.php. I can recommend the fillcols and of course the SAS utils packages. The SAS utils package contains scripts for running SAS in batch mode (and automatically opening the log and lst files), for inserting date, file name, SAS comments, for getting a list of SAS macros in the current SAS file, and for parsing SAS log files for errors, warnings, or relevant notes.

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 (click here to view). See the Readme.txt file for details on where to place these files.

See also

References