CSULB_STAT475_handout22

CSULB_STAT475_handout22 - STAT 475 INTRODUCTION TO SAS...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
STAT 475 INTRODUCTION TO SAS MACRO LANGUAGE Reference SAS Certification Prep Guide: Advanced Programming for SAS 9 The SAS macro language is generally used to shorten SAS codes. Macro language is composed of macro variables, macro functions and macro programs . Macro variables are either user-defined or system-defined (or automatic ). User-defined macro variables are either global or local . A global variable can be used in any SAS procedure or data step, whereas a local variable can be used only inside the macro program in which it was defined. USER-DEFINED MACRO VARIABLES A user-defined macro variable is a string variable that substitutes some text in a SAS code. The macro variable can be created by using the %let statement. When it is referenced, it is preceded by the ampersand sign . When the code is submitted, SAS processes macro variables first, substituting them with the text string they were defined to be and then processed the code as a standard SAS code. Example. The data grades contain scores on several assignments. Below is a regular SAS code that computes means of these scores. data grades; input id$ quiz1 hw1 exam1 quiz2 hw2 exam2; cards; 0495 94 97 95 94 100 97 8612 89 92 82 97 100 88 6236 94 89 85 91 94 86 ; proc means data=grades; var quiz1 hw1 exam1 quiz2 hw2 exam2; run; 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The output is The MEANS Procedure Variable N Mean Std Dev Minimum Maximum ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ quiz1 3 92.3333333 2.8867513 89.0000000 94.0000000 hw1 3 92.6666667 4.0414519 89.0000000 97.0000000 exam1 3 87.3333333 6.8068593
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

CSULB_STAT475_handout22 - STAT 475 INTRODUCTION TO SAS...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online