Tutorial by Topics: macro



All preprocessor commands begins with the hash (pound) symbol #. A C macro is just a preprocessor command that is defined using the #define preprocessor directive. During the preprocessing stage, the C preprocessor (a part of the C compiler) simply substitutes the body of the macro wherever its name appears.

X-macros are a preprocessor-based technique for minimizing repetitious code and maintaining data / code correspondences. Multiple distinct macro expansions based on a common set of data are supported by representing the whole group of expansions via a single master macro, with that macro's replacement text consisting of a sequence of expansions of an inner macro, one for each datum. The inner macro is traditionally named X(), hence the name of the technique.

Macros are a form of compile time metaprogramming. Certain elements of Scala code, such as annotations and methods, can be made to transform other code when they are compiled. Macros are ordinary Scala code that operate on data types that represent other code. The [Macro Paradise][] plugin extends the abilities of macros beyond the base language. [Macro Paradise]: http://docs.scala-lang.org/overviews/macros/paradise.html
ANSI C defines a number of macros. Although each one is available for your use in programming, the predefined macros should not be directly modified.

We have new features for Eloquent Relationship in Laravel version 5.4.8. We can fetch a single instance of a hasMany (it is just one example) relationship by define it at on place and it will works for all relationship

Rust 1.15 added (stabilized) a new feature: Custom derive aka Macros 1.1.

Now apart from usual PartialEq or Debug you can have #[deriving(MyOwnDerive)]. Two primary users of the feature is serde and diesel.

Rust Book link: https://doc.rust-lang.org/stable/book/procedural-macros.html

One of the challenges I faced when I first started using SAS was not only passing Macro Variable data into a PROC SQL pass-through, but having it resolve properly if it needed quotes around it. When passing a string like value or date/datetime into a PROC SQL pass-through, it most likely needs to have single quotes around it when it resolves.

I have found the best results when using the %BQUOTE function to accomplish this.

Using Macro Variables throughout your SAS programs is a basic functionality that every SAS programmer must be familiar with. Using Macro Variables can help you to keep your code simple and generic. Generic code is reusable code.


Page 1 of 2