首页风格
门户
博客

SAS编程入门介绍

日期:2012/02/06  来源:GBin1.com

SAS编程入门介绍

1.Why to learn SAS?

Everyone has his/her own answer. But if you want to work with SAS, you should learn it.

2.Where to use SAS?

Data process, analysis and presentation.

3.IDE

  • Enterprise Guide
  • Eclipse SAS Editor Plugin (for java programmers)
  • WPS (I have never used it.)
  • Enhanced Editor (for experienced SAS programmers)

4.Core SAS

产品

  • BASE SAS
  • SAS Products for analysis, such as SAS/STAT, SAS/ETS and SAS/OR
  • SAS/GRAPH

基本 (SAS E-Learning):

Advanced (SAS E-Learning):

Points

  • libref
  • fileref
  • sas files (data set, view, index, catalog)
  • data step concepts (data set, variable, pdv, loop)
  • data import and export
  • data step plus infile
  • proc import
  • libname (database, excel, access, pcfiles, webdav, xml)
  • Import wizard (You may use it to generate SAS code if you are not familiar with SAS programming.)
  • data step plus file
  • proc export
  • libname (database, excel, access, pcfiles, webdav, xml)
  • Export wizard (You may use it to generate SAS code if you are not familiar with SAS programming.)
  • ODS
  • formats and informats
  • Where to use it?
  • Importing and exporting data, summary, lookup, presentation.
  • How to generate it?
  • Proc format
  • Proc format cntlin=SAS data set
  • It supports multi label and this is very useful when you summarize data.
  • hash
  • array
  • functions and call routines
  • most commonly-used procedures such as sort, summary etc.
  • proc sql
  • macro (macro variable, macro, debug, compiled macro, quote)
  • SAS Graph, ODS Graphics, ODS Graphics Designer
  • ODS report
  • SAS System
  • system options
  • system reserved variables (_n_, _error_, _numeric_, _character_, _all_, _infile_, _last_, _null_, _data_)
  • _n_, _error_
  • _numeric_, _character_, _all_
  • _infile_
  • _last_: the most recently created SAS data set.
  • _null_, _data_: reserved SAS data set name
  • system views under SAShelp
  • system procedures (proc options, proc javainfo, proc setinit)

Misc.

Enterprise Guide (resource to get SAS code to do analysis or generate graph and ODS report)

DI Studio (resource to get SAS code to import various data)

5.Advanced SAS Programming

6.Required Knowledge for SAS Staff

  • SAS naming conventions
  • Portable code (one code, runnable on all operating systems)
  • Multi-language support aka NLS

7. SAS Intelligence Platform

8.Integration with other languages (SAS Integration Technologies)

SAS can do everything, but sometimes it is not easy or suitable to do some processes using SAS, so the only method to figure out the best way is to learn more about SAS and integration as well.

  • In-database model publish (run SAS model via SQL after publish)
  • PROC PSCORE (PMML model support)
  • PROC IML (R language support)
  • JAVA Data Step Object (run java code in SAS)
  • PROC Groovy
Groovy is a dynamic language that runs on the Java Virtual Machine (JVM). PROC GROOVY enables SAS code to execute Groovy code on the JVM.

PROC GROOVY can run Groovy statements that are written as part of your SAS code, and it can run statements that are in files that you specify with PROC GROOVY commands. It can parse Groovy statements into Groovy Class objects, and run these objects or make them available to other PROC GROOVY statements or Java DATA Step Objects.
proc groovy classpath=cp;

submit parseonly;

class Speaker {

def say( word ) {

println "----> \"${word}\""

}

}

endsubmit;

quit;

proc groovy classpath=cp;

eval "s = new Speaker(); s.say( ""Hi"" )";

quit;

The finance analyst is always working with equations, or many equations. Obviously here SAS is not good at it. Yes, SAS has more than 900 functions. And they are still not enough to keep up with the fast-pace of Wall Street. That is why the quants use Matlab, C++ and Excel VBA, instead of SAS. http://www.SASanalysis.com/2010/10/from-vba-to-proc-fcmp-in-SAS.html

The PROTO procedure provides a simple interface to register external functions written in C/C++ for use in SAS. All functions registered in proc PROTO can be then used in FCMP. Proc Fcmp is a formidable tool for building function and even function library.

  • Command line mode

9. Grid Computing and High Performance Computing

10.Drawbacks of SAS language

  • Process-oriented not object-oriented (It should be its characteristic rather than drawback.)
  • Exception handling
  • Transaction support (rollback)

11. Four phases of SAS programming

  • Runnable SAS codes for a specific problem
  • Runnable SAS macros for general problems
  • Complicated design and data-driven code generator
  • Clear design and effective code

12.Books you’d better read

13. The End

SAS system is more than above lists (>1000 functions and >350 procedures), so learning and practicing is the power to know SAS.

关于作者

Emily Gao目前就职于SAS北京研发中心,负责领导一个开发团队进行 SAS Model Manager 相关的开发工作,拥有8年SAS开发经验,如果你需要联系她,请发送邮件到

电子邮件:hhshnsq@hotmail.com

个人博客: 爱美丽高

来源: SAS编程入门介绍

喜欢我们的文章请您与朋友分享:

?ü?à

留言

友情提示: 本站博客不再支持访客留言,如果有问题或者留言,请发布到  GBtags.com

  1. 目前没有任何留言
今日推荐