This script shows how to use the `ifc` (If Character) function encapsulated within `%sysfunc` to evaluate a boolean expression. Here, it checks the automatic macro variable `&sysscp` to determine if the operating system is Windows, returning a different character string depending on the result.
Data Analysis
Type : CREATION_INTERNE
The code does not use any data tables; it relies solely on automatic system macro variables.
1 Code Block
MACRO STATEMENT
Explanation : The `%put` command writes to the log. `%sysfunc(ifc(...))` evaluates the condition `&sysscp=WIN`. If true, it returns the first argument ('You are using Windows!'), otherwise the second ('You are not using Windows'). It's a concise alternative to `%if %then %else` for assignments or simple displays.
Copied!
*** The mighty IF in macro language ! ;
%put %sysfunc(ifc(&sysscp=WIN,You are using Windows!,You are not using Windows)) ;
1
*** The mighty IF in macro language ! ;
2
%put %sysfunc(ifc(&sysscp=WIN,You are using Windows!,You are not using Windows)) ;
3
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.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.