1 / 32

SAS Statistics with SAS package

SAS Statistics with SAS package. PGDASS class. SAS. SAS: Statistical Analysis System 9.2 Statistical Package: very costly Pronounced as SAAS. Change date to April 2014 Right click on date Adjust date and time Change date to April 2014. What is SAS?.

Albert_Lan
Download Presentation

SAS Statistics with SAS package

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SASStatistics with SAS package PGDASS class Anil Arekar

  2. SAS SAS: Statistical Analysis System 9.2 Statistical Package: very costly Pronounced as SAAS Anil Arekar

  3. Anil Arekar

  4. Change date to April 2014 • Right click on date • Adjust date and time • Change date to April 2014 Anil Arekar

  5. Anil Arekar

  6. Anil Arekar

  7. What is SAS? • Began as a statistical package • Also allows users to: • Store data • Manipulate data • Create reports • PDF • Excel • HTML • XML • RTF / Word • Etc. Etc. Etc.

  8. What is SAS? • Also allows users to: • Create graphs • Create maps • Send e-mails • Create web applications • Create iPhone Apps • Access R • Schedule regularly run reports • Etc. Etc. Etc.

  9. Log: Details about jobs you’ve run, including error messages Explorer Window: See libraries and SAS datasets Enhanced Editor: Where you write your SAS code

  10. Results tab: List of previously run results Output Window: Basic view of results and output (Also known as “Listing Destination”)

  11. Run: Submits your SAS code (“The Running Man”)

  12. You can submit the program as a whole or Run only a portion of highlighted code

  13. Chunks of code will be processed in the order you RUN them, not necessarily in the order you wrote them

  14. DATA steps: Read and write data, manipulate data, perform calculations, etc. Every DATA step creates a new dataset

  15. Every SAS program can have multiple DATA and PROC steps PROC steps: Produce reports, summarize data, sort data, create formats, generate graphs, etc. etc. etc.

  16. Global statements: Remain in effect until changed by another global statement or SAS session ends Examples: Titles, Footnotes, Options, Macros, Libname

  17. Comment statements: Ignored by SAS when code is run Used to write comments to yourself or others or comment out code you don’t want to run *comment statement; or /* comment statement */

  18. Programming in SAS • SAS is generally forgiving • Code can be written on a single line or multiple lines • Code and variable names not case sensitive • Even accepts some misspellings • Semicolons are super important • Colors of Enhanced Editor • Always check your log!!! • Often many ways to do the same thing

  19. Where to learn more about SAS http://www.sascommunity.org/wiki/Learning_SAS_-_Resources_You_Can’t_Live_Without Popular Websites Technical papers SAS User Groups Websites Books Classes

  20. Basic Screen Navigation • Editor contains the SAS program to be submitted. • Log contains information about the processing of the SAS program, including any warning and error messages • Output contains reports generated by SAS procedures and DATA steps

  21. Reading raw data set into SAS system • In order to create a SAS data set from a raw data file, you must • Start a DATA step and name the SAS data set being created (DATA statement) • Identify the location of the raw data file to read (INFILE statement) • Describe how to read the data fields from the raw data file (INPUT statement)

  22. Thinking in “SAS” • What is a program? • Algorithm, recipe, set of instructions • How is programming done in SAS? • SAS is like programming in any language: • Step by step instructions • Can create your own routines to process data • Most instructions are set up in a logical manner • SAS is NOT like other languages: • Some syntax is peculiar to SAS • Written specifically for statistics so it isn’t all-purpose • Canned processes that you cannot edit nor can you see the code

  23. Thinking in “SAS” • Creating a program • What is your problem? • How can you find a solution? • What steps need to be taken to find an answer? • Do I need to read in data? • What variables do I need? • Where is the data? • What format is the data in? • How do I need to clean the data? • Are there outliers? • Are there any unexpected values in the data? • How do I need to transform the data? • Are the variables in the form that I need?

  24. Basic rules– organize files • .sas – program file • .log – notes, errors, warnings • .lst – output • .sas7bdat – data file • library – a cabinet to put data in • Default: Work library • temporary, erased after you close the session • Permanent library • libnamemylib “m:\”; • mylib.mydata = a sas data file named “mydata” in library “mylib” • run and recall .sas

  25. /* comment: in green, does not take into calculation */ /* simple example to calculate mean */ /* data are given in the following format */ /* dataset name=grade */ /* data description input name of the variables*/ /* Character variables are mentioned as dollar $*/ /* numerical variables are without dollar sign */ /* for running program press F3 or select and run sign*/ Anil Arekar

  26. data marks; input Name $ Gender $ Status Year marks @@; datalines; A F 2 12 70 B M 1 13 82 C M 2 13 91 D F 2 12 78 E M 1 12 95 F M 2 13 86 ; run; procprint data=marks; run; /* overall mean */ Anil Arekar

  27. procmeans data=marks n mean max min range std; var marks; title 'Summary of marks'; run; /* sexwise means */ procmeans data=marks n mean max min range std; var marks; class Gender; title 'Summary of marks as per sex'; run;  /* yearwise means */ procmeans data=marks n mean max min range std; var marks; class year; title 'Summary of marks as per year'; run; Anil Arekar

  28. Anil Arekar

  29. Anil Arekar

  30. Anil Arekar

  31. Anil Arekar

  32. Anil Arekar

More Related