Published on :
Macro CREATION_INTERNE

Company Name Resolution Macro

This code is also available in: Deutsch Español Français
This script defines a `%company` macro that takes a company code as input. It uses the macro-quoting function `%superq` to securely compare the provided value with predefined strings ('SAS©', 'GE', 'H-P') and displays the corresponding full name in the log via the `%put` statement.
Data Analysis

Type : CREATION_INTERNE


The script does not manipulate any data tables; it only performs logical operations and displays output in the log.

1 Code Block
MACRO DEFINITION
Explanation :
Macro definition with a conditional `%if-%then-%else` structure. The use of `%superq(co)` protects the value of the macro variable `co` during comparison, preventing syntax errors if it contains special characters.
Copied!
1%macro company(co);
2 %IF %superq(co)=SAS %THEN %put SAS Institute;
3 %ELSE %IF %superq(co)=%str(GE) %THEN %put General Electric;
4 %ELSE %IF %superq(co)=%str(H-P) %THEN %put Hewlett-Packard;
5 %ELSE %put Whatever;
6%mend company;
2 Code Block
MACRO CALL
Explanation :
Series of macro calls to test the different defined conditions (SAS, GE, H-P) as well as the default case (IBM).
Copied!
1%company(SAS)
2%company(GE)
3%company(H-P)
4%company(IBM)
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.