Type of Tool | SAS Macro |
Title | Categorize |
Programmer/Email | ArthurWatts |
Contributing Site | Rochester |
Description | This set of Macros categorizes variables from a dataset as continuous, discrete or dates. The following five variable lists are created and saved in macro variables for the user. 1. Dates : list of variables formatted as dates. 2. Discrete : list of variables with integer values based on your specification by the parameter “maxcat” in the program. For example if you specify maxcat=8, then variables that have 8 or fewer unique values in the data are determined to be a discrete variable. 3. Continuous : list of variables with real values, or with a greater number integer values than the cutoff as defined by the parameter “maxcat”. 4. CharDiscr : List of discrete character variables. 5. Characters : List of non-discrete character variables. This set of macros also captures the number of discrete variables and number of continuous variables. The macro variables generated from the categorize macro can easily be fed into SAS procedures such as PROC MEANS and PROC FREQ to generate summary statistics and frequencies in accordance with the variable types. |
Example | Example Code |
Classification Graph Type | |
References | |
Datasets | Other |
Data | Rochester_Categorize_Download Sample Data |
Software Program | SAS |
Software | SAS |
Macro Parameters | dataset : name of SAS dataset to use. maxcat: maximum # of unique values for a discrete variable. discrete : List of variables with <=N unique values. continuous: List of variables with >N unique values. dates : List of variables formatted as dates. CharDiscr: List of discrete character variables with <=N unique values. Characters: List of non-discrete character variables with >N unique values. Ndiscrete: Number of discrete numeric variables. Ncontinuous : Number of continuous numeric variables. |
R-Code - Attachment | |
R-Code | |
SAS-Code - Attachment | Rochester_Categorize Macro |
SAS-Code | |
Stata-Code - Attachment | |
Stata-Code | |
Other Code - Attachment | |
Other Code | |
Called Data Manipulation | |
Called Tool/Utility | |
Called Checking Macro | |
Called Other | |
Creation-Date | |
Revision-Date | Rev 3 - Mar 29, 2010 |
Example Code | SAS Example Code |
Example Output | SAS Example Output |
SAS Examples | |
SAS_Example_Code | Rochester_Categorize_SAS Example Code |
SAS_Example_Output | Rochester_Categorize_SAS Example Output Sample List [[https://www.ctspedia.org/CTSpedia/CategorizeEX.attachments/sampledata.htm][Rochester_Categorize_ SAS Example Output] |
R Examples | |
R_Example_Code | |
R_Example_Output | |
Stats Examples | |
Special Features | |
Special Features Attached | |
Special Features Text | |
Notes1-Legend | Section with calls to needed macros |
Notes1 | filename Cate URL "http://ctspedia.org/twiki/pub/CTSpedia/CategorizeEX/Categorize.sas"; %include Cate; |
Notes2-Legend | Macro call with fully specified parameters |
Notes2 | %Categorize(dataset,maxcat,discrete,continous,mdates,CharDiscr,Characters,Ndiscrete,Ncontinous); |
Notes3-Legend | Section with definitions of global macro parameters |
Notes3 | &_discrete, &_continous, &_mdates, &_Ndiscrete, &_Ncontinous, &_CharDiscr, &_Characters. |
Notes4-Legend | Section with definitions of local macro variables |
Notes4 | N/A |
See Also | |
Checklists | |
Stat Tools Disclaimer | This set of SAS macros is developed by Arthur Watts and other members in the Department of Biostatistics and Computational Biology at the University of Rochester under the auspice of the CTSI BERD with the intent to facilitate to capture data information in all the related fields. It is copyrighted by Arthur Watts, 2009 and distributed for free public access. |
Discliamer | The views expressed within CTSpedia are those of the author and must not be taken to represent policy or guidance on the behalf of any organization or institution with which the author is affiliated. |
Permission | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT OLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Reference Image |