When you want to analyze all variables of a certain type, you can use these keywords, as follows: Many SAS procedures use a VAR statement to specify the variables to be analyzed. You can specify all character variables by using the _CHARACTER_ keyword. You can specify all numeric variables in a data set by using the _NUMERIC_ keyword. Use the _NUMERIC_, _CHARACTER_, and _ALL_ keywords However, for developing code and constructing examples, lists can be a huge time saver. If the number and names of variables in your data sets occasionally change, it is safer to manually list the variables that you are analyzing. Some companies might discourage the use of variable lists in production code because automated lists can be volatile. Use macro variables to specify variables that satisfy certain characteristics.Use the OF operator to specify variables in an array or in a function call.You can also use a variation of this syntax to specify a consecutive set of variables of a certain type (numeric or character). Use a double-hyphen (-) to specify a consecutive set of variables, regardless of type.Use the colon operator (:) to specify a list of variables that begin with a common prefix.Use a single hyphen (-) to specify a range of variables that have a common prefix and a sequential set of numerical suffixes.Use the _NUMERIC_, _CHARACTER_, and _ALL_ keywords to specify variables of a certain type (numeric or character) or all types.There is a section in the SAS documentation that describes how to construct lists, but this blog post provides more context and a cut-and-paste example for every syntax. This article describes six ways to specify a list of variables in SAS. You can also use variable lists on the VAR statements and MODEL statements of analytic procedures. SAS statements that accept variable lists include the KEEP and DROP statements, the ARRAY statement, and the OF operator for comma-separated arguments to some functions. The SAS language provides syntax that enables you to quickly specify a list of variables.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |