As always, the name of the macro variable must comply with the SAS naming convention. The name of the macro variable is either a text string, a variable name of a SAS dataset, or a character expression that creates a text string. CALL SYMPUT(macro_variable_name = value) This function has two mandatory arguments, namely: The CALL SYMPUT routine is a combination of the CALL keyword and the SYMPUT function. Therefore, this method is perfect for creating macro variables from a dataset. This routine assigns a value produced in a Data Step to a macro variable. In the example below, we create a macro variable ( my_name) and assign it a value ( David).Ĭreate a Macro Variable with the CALL SYMPUT RoutineĪnother way to create a macro variable in SAS is by using the CALL SYMPUT routine. If you omit the value, SAS creates a null value (i.e., a macro variable of length 0). The value of the macro variable is a character string or a number. Also, the name must be 32 or fewer characters long and cannot contain blanks or special characters (except blanks). In other words, the name should start with an underscore or a letter from the Latin alphabet (A-Z, a-z). The name of the macro variable must comply with the SAS naming convention. This is the syntax of the %LET statement: %LET macro_variable_name = value You can also use the %LET statement to overwrite the existing value of a macro variable. This statement creates a macro variable and assigns it a value. The easiest way to create a macro variable in SAS is by using the %LET Macro Statement. Comparison of the %LET Macro Statement, the CALL SYMPUT Routine, and the PROC SQL INTO clause Create a Macro Variable with the %LET Statement.Create a List of Macro Variables with the PROC SQL INTO Clause.Create a Multiple Macro Variables of Different Columns with the PROC SQL INTO Clause.Create Multiple Macro Variables with the PROC SQL INTO Clause.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |