Skip to content

vim-scripts/indsas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

This is a mirror of http://www.vim.org/scripts/script.php?script_id=3624

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.


 
	
 

About

Indentation for SAS scripts

Resources

Stars

Watchers

Forks

Packages

No packages published