SlideShare una empresa de Scribd logo
1 de 30
Introduction to SAS
Programming
Christina L. Ughrin
Statistical Software Consulting
Some notes pulled from SAS
Programming I: Essentials Training
SAS Datasets
Examining the structure of SAS
Datasets
SAS Data Sets
Two Sections
Descriptor Section
Data Section
Data Set Descriptor Section
SAS Data Section
Attributes of Variables
 Name
 e.g. Status
 Type
 Numeric or Character
 e.g. Status in this example is character (T, TT,
PT, or NTT) and Satisfaction is numeric (1 to 5).
SAS Data Set Terminology
 Variables – columns in a SAS data set.
 Observations – rows in a SAS data set.
 Numeric Data – values that are treated as numeric
and may include 8 bytes of floating storage for 16 to
17 significant digits.
 Character Data – non numeric data values such as
letters, numbers, special characters, and blanks.
May be stores with a length of 1 to 32, 767 bytes.
One byte is equal to one character.
SAS Data Set and Variable
Name Criteria
 Can be 32 characters long.
 Can be uppercase, lowercase, or a mixture of
the cases.
 Are not case sensitive
 Cannot start with number and cannot contain
special characters or blanks.
 Must start with a letter or underscore.
SAS Dates
 Dates are treated as special kind of numeric data.
 They are the number of days since January 1st, 1960.
January 1st 1960 is the 0 point. SAS dates can go back to
1582 (Gregorian Calendar) and forward to the year 20000.
 Dates are displayed using a format. There are a number of
different date formats supported by SAS.
 Time is scored as the number of seconds since
midnight. SAS date time is the number of seconds
since January 1st, 1960.
Missing Data in SAS
 Missing values are valid values.
 For character data, missing values are displayed as blanks.
 For numeric data, missing values are displayed as periods.
SAS Syntax
SAS Syntax
 Statements in SAS are like sentences. The
punctuation though is a semicolon( ; )rather
than a period ( . )
 Most Statements (but not all) start with an
identifying key word (e.g. proc, data, label,
options, format…)
 Statements are strung together into sections
similar to paragraphs. These paragraphs in a
Windows OS are ended with the word “run”
and a semicolon.
Example of SAS Syntax
SAS Syntax Rules
 SAS statements are format free.
 One or more blanks or special characters are
used to separate words.
 They can begin and end in any column.
 A single statement can span multiple lines.
 Several statements can be on the same line.
Example of SAS Free Format
Using the free-format Syntax
rules of SAS though can make it difficult for others (or you) to read your
program. This is akin to
writing a page of text with little attention to line breaks. You may still have
Capital letters and periods, but where a sentence begins and ends may be a bit confusing.
Example of SAS Formatted
Using the free-format Syntax rules of SAS though can make it difficult for others
(or you) to read your program. This is akin to writing a page of text with little
attention to line breaks. You may still have capital letters and periods, but where a
sentence begins and ends may be a bit confusing. Isn’t this paragraph a bit
easier to read?
SAS Comments
 Type /* to begin a comment.
 Type your comment text.
 Type */ to end the comment.
 Or, type an * at the beginning of a line. Everything
between the * and the ; will be commented.
 e.g. *infile ‘tutor.dat’;
 Alternatively, highlight the text that you would like to
comment and use the keys Ctrl / to comment the
line. To uncomment a line, highlight and use the
Ctrl Shift / keys.
SAS Comments
SAS Windows
SAS Windows
Log
Editor
Explorer
Enhanced Editor Window
 Your program script appears in this window.
 You can either bring it in from a file or type the program right into the window.
 Once the program is in the window, you can Click Submit (or the running guy).
Enhanced
Editor
Output
SAS Log
 SAS Log provides a “blow by blow” account of the execution of your program. It
includes how many observations were read and output, as well as, errors and notes.
 Note the errors in red.
Output Window
SAS Library
 SAS Data Libraries are like drawers in a filing cabinet. The SAS data sets are files
within those drawers. Note the icons for the SAS library match that metaphor.
 In order to assign a “drawer”, you assign a library reference name (libref).
 There are two drawers already in your library: work (temporary) and sasuser
(permanent).
 You can also create your own libraries (drawers) using the libname statement.
Establishing the libname
libname Tina ‘E:TrainingsJMP Training’;
run;
Type the libname
command in the
Enhanced Editor.
Click on the
running icon
Viewtable Window
Proc Reg
Proc reg data= Tina.hsb2;
Model write = read / clb;
Run;
Proc Univariate
Proc Univariate
Proc Univariate
Proc Univariate

Más contenido relacionado

Similar a SAS_Overview_Short.pptx

Basics Of SAS Programming Language
Basics Of SAS Programming LanguageBasics Of SAS Programming Language
Basics Of SAS Programming Languageguest2160992
 
Introduction To Sas
Introduction To SasIntroduction To Sas
Introduction To Sashalasti
 
8323 Stats - Lesson 1 - 03 Introduction To Sas 2008
8323 Stats - Lesson 1 - 03 Introduction To Sas 20088323 Stats - Lesson 1 - 03 Introduction To Sas 2008
8323 Stats - Lesson 1 - 03 Introduction To Sas 2008untellectualism
 
Sas Enterprise Guide A Revolutionary Tool
Sas Enterprise Guide A Revolutionary ToolSas Enterprise Guide A Revolutionary Tool
Sas Enterprise Guide A Revolutionary Toolsysseminar
 
BAS 150 Lesson 4 Lecture
BAS 150 Lesson 4 LectureBAS 150 Lesson 4 Lecture
BAS 150 Lesson 4 LectureWake Tech BAS
 
Business and information quality.docx
Business and information quality.docxBusiness and information quality.docx
Business and information quality.docxstudywriters
 
spss presentation.pdf
spss presentation.pdfspss presentation.pdf
spss presentation.pdfAbebeNega
 
IEEE-Template.docx
IEEE-Template.docxIEEE-Template.docx
IEEE-Template.docxsaran2011
 
Analytics with SAS
Analytics with SASAnalytics with SAS
Analytics with SASEdureka!
 
Trans jour
Trans jourTrans jour
Trans jourRam B
 
a. Collect at least six published papers in one of the new tre.docx
a. Collect at least six published papers in one of the new tre.docxa. Collect at least six published papers in one of the new tre.docx
a. Collect at least six published papers in one of the new tre.docxdaniahendric
 
L4 Fashioning Text Styles and Colors
L4   Fashioning Text Styles and ColorsL4   Fashioning Text Styles and Colors
L4 Fashioning Text Styles and Colorsmykella
 

Similar a SAS_Overview_Short.pptx (20)

Basics Of SAS Programming Language
Basics Of SAS Programming LanguageBasics Of SAS Programming Language
Basics Of SAS Programming Language
 
Introduction To Sas
Introduction To SasIntroduction To Sas
Introduction To Sas
 
SAS - overview of SAS
SAS - overview of SASSAS - overview of SAS
SAS - overview of SAS
 
8323 Stats - Lesson 1 - 03 Introduction To Sas 2008
8323 Stats - Lesson 1 - 03 Introduction To Sas 20088323 Stats - Lesson 1 - 03 Introduction To Sas 2008
8323 Stats - Lesson 1 - 03 Introduction To Sas 2008
 
Sas Enterprise Guide A Revolutionary Tool
Sas Enterprise Guide A Revolutionary ToolSas Enterprise Guide A Revolutionary Tool
Sas Enterprise Guide A Revolutionary Tool
 
BAS 150 Lesson 4 Lecture
BAS 150 Lesson 4 LectureBAS 150 Lesson 4 Lecture
BAS 150 Lesson 4 Lecture
 
Quick start learn dax basics in 30 minutes
Quick start   learn dax basics in 30 minutesQuick start   learn dax basics in 30 minutes
Quick start learn dax basics in 30 minutes
 
Basics of SAS
Basics of SASBasics of SAS
Basics of SAS
 
Sas
SasSas
Sas
 
Business and information quality.docx
Business and information quality.docxBusiness and information quality.docx
Business and information quality.docx
 
spss presentation.pdf
spss presentation.pdfspss presentation.pdf
spss presentation.pdf
 
IEEE-Template.docx
IEEE-Template.docxIEEE-Template.docx
IEEE-Template.docx
 
Sas training in hyderabad
Sas training in hyderabadSas training in hyderabad
Sas training in hyderabad
 
SAS Online Training by Real Time Working Professionals in USA,UK,India,Middle...
SAS Online Training by Real Time Working Professionals in USA,UK,India,Middle...SAS Online Training by Real Time Working Professionals in USA,UK,India,Middle...
SAS Online Training by Real Time Working Professionals in USA,UK,India,Middle...
 
Analytics with SAS
Analytics with SASAnalytics with SAS
Analytics with SAS
 
Plantilla ieee
Plantilla ieeePlantilla ieee
Plantilla ieee
 
Plantilla IEEE
Plantilla IEEEPlantilla IEEE
Plantilla IEEE
 
Trans jour
Trans jourTrans jour
Trans jour
 
a. Collect at least six published papers in one of the new tre.docx
a. Collect at least six published papers in one of the new tre.docxa. Collect at least six published papers in one of the new tre.docx
a. Collect at least six published papers in one of the new tre.docx
 
L4 Fashioning Text Styles and Colors
L4   Fashioning Text Styles and ColorsL4   Fashioning Text Styles and Colors
L4 Fashioning Text Styles and Colors
 

Último

Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Delhi Call girls
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...shivangimorya083
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxJohnnyPlasten
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxolyaivanovalion
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Delhi Call girls
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceDelhi Call girls
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxolyaivanovalion
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% SecurePooja Nehwal
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...SUHANI PANDEY
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfRachmat Ramadhan H
 

Último (20)

Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptx
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFx
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
 

SAS_Overview_Short.pptx

  • 1. Introduction to SAS Programming Christina L. Ughrin Statistical Software Consulting Some notes pulled from SAS Programming I: Essentials Training
  • 2. SAS Datasets Examining the structure of SAS Datasets
  • 3. SAS Data Sets Two Sections Descriptor Section Data Section
  • 6. Attributes of Variables  Name  e.g. Status  Type  Numeric or Character  e.g. Status in this example is character (T, TT, PT, or NTT) and Satisfaction is numeric (1 to 5).
  • 7. SAS Data Set Terminology  Variables – columns in a SAS data set.  Observations – rows in a SAS data set.  Numeric Data – values that are treated as numeric and may include 8 bytes of floating storage for 16 to 17 significant digits.  Character Data – non numeric data values such as letters, numbers, special characters, and blanks. May be stores with a length of 1 to 32, 767 bytes. One byte is equal to one character.
  • 8. SAS Data Set and Variable Name Criteria  Can be 32 characters long.  Can be uppercase, lowercase, or a mixture of the cases.  Are not case sensitive  Cannot start with number and cannot contain special characters or blanks.  Must start with a letter or underscore.
  • 9. SAS Dates  Dates are treated as special kind of numeric data.  They are the number of days since January 1st, 1960. January 1st 1960 is the 0 point. SAS dates can go back to 1582 (Gregorian Calendar) and forward to the year 20000.  Dates are displayed using a format. There are a number of different date formats supported by SAS.  Time is scored as the number of seconds since midnight. SAS date time is the number of seconds since January 1st, 1960.
  • 10. Missing Data in SAS  Missing values are valid values.  For character data, missing values are displayed as blanks.  For numeric data, missing values are displayed as periods.
  • 12. SAS Syntax  Statements in SAS are like sentences. The punctuation though is a semicolon( ; )rather than a period ( . )  Most Statements (but not all) start with an identifying key word (e.g. proc, data, label, options, format…)  Statements are strung together into sections similar to paragraphs. These paragraphs in a Windows OS are ended with the word “run” and a semicolon.
  • 13. Example of SAS Syntax
  • 14. SAS Syntax Rules  SAS statements are format free.  One or more blanks or special characters are used to separate words.  They can begin and end in any column.  A single statement can span multiple lines.  Several statements can be on the same line.
  • 15. Example of SAS Free Format Using the free-format Syntax rules of SAS though can make it difficult for others (or you) to read your program. This is akin to writing a page of text with little attention to line breaks. You may still have Capital letters and periods, but where a sentence begins and ends may be a bit confusing.
  • 16. Example of SAS Formatted Using the free-format Syntax rules of SAS though can make it difficult for others (or you) to read your program. This is akin to writing a page of text with little attention to line breaks. You may still have capital letters and periods, but where a sentence begins and ends may be a bit confusing. Isn’t this paragraph a bit easier to read?
  • 17. SAS Comments  Type /* to begin a comment.  Type your comment text.  Type */ to end the comment.  Or, type an * at the beginning of a line. Everything between the * and the ; will be commented.  e.g. *infile ‘tutor.dat’;  Alternatively, highlight the text that you would like to comment and use the keys Ctrl / to comment the line. To uncomment a line, highlight and use the Ctrl Shift / keys.
  • 21. Enhanced Editor Window  Your program script appears in this window.  You can either bring it in from a file or type the program right into the window.  Once the program is in the window, you can Click Submit (or the running guy). Enhanced Editor Output
  • 22. SAS Log  SAS Log provides a “blow by blow” account of the execution of your program. It includes how many observations were read and output, as well as, errors and notes.  Note the errors in red.
  • 24. SAS Library  SAS Data Libraries are like drawers in a filing cabinet. The SAS data sets are files within those drawers. Note the icons for the SAS library match that metaphor.  In order to assign a “drawer”, you assign a library reference name (libref).  There are two drawers already in your library: work (temporary) and sasuser (permanent).  You can also create your own libraries (drawers) using the libname statement.
  • 25. Establishing the libname libname Tina ‘E:TrainingsJMP Training’; run; Type the libname command in the Enhanced Editor. Click on the running icon
  • 27. Proc Reg Proc reg data= Tina.hsb2; Model write = read / clb; Run;