sponsor Vim development Vim logo Vim Book Ad

indsas : Indentation for SAS scripts

 script karma  Rating 0/0, Downloaded by 1143  Comments, bugs, improvements  Vim wiki

created by
David Yeung
 
script type
utility
 
description
A Perl script to indent a lousily indented or indentless SAS script.

Example:
indsas xxx.sas
or
indsas xxx.sas > new_xxx.sas


It can be invoked in VIM by adding a line to .vimrc file.
set ep=your_path_to_indsas/indsas

While you are editing a file with VIM, type this to indent the whole file
gg=G

if you want to go back to the current position after indenting, add this to your .vimrc
nmap gW magg=G'a
and you can type gW to indent the whole file at any position of the file.


NOTE:
1) indsas assumes the following SAS scripting(indenting) styles for input and merge statements:

==INPUT===
data a1;
    infile 'xxxx.txt';
    input
         var1 $
         var2 $
         .......
    ;
run;

==MERGE===
data new;
       merge
            dat1(in=a)
            dat2(in=b)
       ;
run;

2) indsas also assumes the following scripting style:
   *PROC and DATA statements are always accompanied with RUN;
   *DO,IF xxx THEN DO and ELSE DO should be closed by END;
   *PROC SQL should be closed by QUIT;

3) This script is still very primitive and does not account for all other eccentric scripting styles.

4) indsas does not handle "cards" or "datalines" correctly. Please manually adjust those lines.

5) indsas was only tested in the unix/linux environment.




 
install details
download and move indsas to whatever folder you like. Add that folder to your $PATH variable if you haven't done that yet.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
indsas V1.2 2012-05-21 7.0 David Yeung The script can now take file name as argument, no need to use it with pipe.
indsas V1.1 2011-07-07 7.0 David Yeung added codes for PUT statement(Same as INPUT)
indsas V1 2011-06-11 7.0 David Yeung Initial upload
ip used for rating: 18.222.193.207

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github