BookmarkSubscribeRSS Feed

[2-1] Macro - Macro Variables(Introduction to Macro Variables)

Started ‎06-16-2020 by
Modified ‎06-16-2020 by
Views 103

[2-1] Macro - Macro Variables(Introduction to Macro Variables) 

 

 

 

안녕하세요^^

 

이번 시간에는, Macro Variable에 대해 알아보겠습니다.

 

 

학습목표는 다음 두 가지입니다.

 

[1] 매크로 변수가 무엇이고, 매크로 변수가 어디에 저장되는지 알기

[2] 두 종류의 매크로 변수에 대해 알기

 

 

 

■ 매크로 변수(MACRO VARIABLE)이 무엇인지 알아보겠습니다.

 

매크로 변수는 text(문자)를 저장합니다.

 

매크로 변수는, SAS Code에서 Symbol로써 참조하기 때문에, 

symbolic variable이라고도 합니다.

 

 

 

■ 매크로 변수는 두 가지 종류가 있습니다.

 

하나는 automatic macro variable이고 

나머지 하나는 User-defined macro variable입니다.

 

각각에 대해 자세히 알아보겠습니다.

 

 

 

먼저 automatic macro variable에 대해 살펴보겠습니다.

 

매크로 변수는 global symbol table”이라고 하는 메모리 장소에 저장됩니다.

 

 

SAS가 시작되면 automatic macro variables이 생성되는 것이지요.

 

 

SE22016071022141070.jpg

 

 

위 그림에서 알 수 있듯이, automatic macro variable의 예로는

SYSDATE, SYSDATE9, SASDAY 이 있습니다.

 

 

 

 

다음으로, User-defined macro variable에 대해 알아보겠습니다.

 

User-defined macro variable은 사용자-정의 매크로 변수로써,

사용자가 직접 생성한 매크로 변수를 말합니다.

 

 

따라서 사용자가 User-defined macro variable를 생성하면

그 매크로 변수는 아래 그림처럼 “global symbol table”에 추가되게 됩니다.

 

 

SE22016071022143170.jpg

 

 

 

 

■ 위에서 배운 두 가지 종류의 매크로 변수는 모두

 

- 항상 Global하게 코딩에 사용할 수 있고,

- 최소 길이는 0(null value), 최대 길이는 65,534(64K)까지 가능합니다.

- 또, 숫자 토큰을 text(문자)로 저장합니다.

 

 

 

이상 매크로 변수에 대한 소개였습니다.

 

감사합니다^^ 

 

Version history
Last update:
‎06-16-2020 05:52 AM
Updated by:
Contributors

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

Article Labels
Article Tags