SAS macro High-level Knowledge points

Source: Internet
Author: User

1. As a macro function, you don't need to enclose character values in quotation marks as Step functions.

One-on-which macro language is different from SAS language is macro-variable valuesbe always text, quotatio n marks is not needed to indicate TEXR constants in the macro language.

  EXAMPLE

Dsid=open ("sasuser.houses", "I"); /*has quotation marks, because it ' s a DATA step function*/
Dsid=open ("&mydata", "&mode");
%let dsid =%sysfunc (open (sasuser.houses, i)); /*has not quatation marks, Becauese it ' s a macro funtion*/
%let dsid=%sysfunc (Open (&mydata,&mode));

2. The compile and execute process of SAS program

STEP-1: Submitted SAS programs start in the input stack.

Step-2: The word scanner takes statements from the input stack and tokenizes the statements into the fundamental units of Words and symbols.

Step-3: The word scanner then direct the tokens to the DATA step compiler, macro processor, command processor or SCL Compi Ler

Step-4: The compiler or processor that receives the tokens checks for Synatax errors,if None is found, the step executes.

3.Understanding Tokens

The fundamental building blocks of a SAS program is the tokens that Word scanner creates from your SAS language state ments. Each word, literal string, number, and special symbol in the statement in your program is a token.

The word scanner determines that a tokens ends when either a blank was found following a token or when another token begins. The maximum of a token unber SAS is 32767 characters.

Special symbol tokens, when followed by either a letter or underscore, signal the word scanner to turn processing over to the macro processor. These characters, the ampersand (&) and the percent sign (%), is called macro triggers .

   

The interactive between macro-language processing and sas-language processing

When the word scanner detects a macro trigger followed by a name token that it sends what follows to the macro processor and T emporarily turn processing over the macro processor. The word scanner suspends tokenization while the macro processor completes its job. Therefore, processing of a macro language reference occurs after tokenization and before compilation.

1. As your SAS programming assistant, the macro processor Codes SAS language statements for your based on the guidelines yo U give it.

2. The macro processor take the macro language statements you write and send Non-macro text, such as SAS Language statements, back to the input stack.

3. The macro processor puts the Non-macro text that it builds back on the top of the input stack.

4. The Word scanner then resumes their work by tokenizing the Non-macro text it received from the Macro Processor.

SAS macro High-level Knowledge points

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.