Using PROC CORRESP on a large data set
PURPOSE:
Convert raw data into a Burt table.
REQUIREMENTS:
Only Base SAS® is required for the %Burt macro. SAS/STAT® is required for PROC CORRESP.
USAGE:
Follow the instructions in the Downloads tab of this sample to save the %BURT macro definition. Replace the text within quotation marks in the following statement with the location of the %BURT macro definition file on your system. In your SAS program or in the SAS editor window, specify this statement to define the %BURT macro and make it available for use:
%inc "<location of your file containing the BURT macro>";
The following macro parameters can be specified. The VARS= parameter is required:
DATA=data-set-name
Specify the name of the input data set. If you do not name a data set, the most recently created SAS data set is used by default.
VAR=variables
Specify the list of character variables to be used in the correspondence analysis.
OPTIONS=<NOMISS>
If you know there are no missing values, the macro might run faster when you specify the NOMISS option.
OUT=data-set-name
Specify the name of the output data set containing the Burt table. If you do not name a data set, the output data set is named BURT.
The Burt macro creates a global macro variable _NVARS that contains the number of categorical variables used.
DETAILS:
PROC CORRESP accepts two forms of input: raw categorical data that you read in by using a TABLES statement and a crosstabulation that you read in by using a VAR statement. It is unlikely that you will ever run out of memory when you use VAR statement. But you might run out of memory when you have a large data set of categorical variables. As an alternative, you can create the crosstabulation, also known as a Burt table, in a more memory-efficient manner outside PROC CORRESP. The Burt macro creates a Burt table by using a DATA step view for preprocessing, PROC FREQ for tabulation, and PROC TRANSPOSE and DATA steps for postprocessing.
LIMITATIONS:
The %Burt macro assumes that all variables are unformatted character variables. (That is, the macro assumes that the variables are not numeric and that the values do not require formats.) If you have numeric variables or formats, you can create a data set view that applies the formats and creates character variables. Then you can send that view into the macro as follows:
%let nvars = 10;
data x1(drop=i j);
array x[&nvars];
length x: 3;
do i = 1 to 1e5;
do j = 1 to &nvars;
x[j] = ceil(uniform(7) * 3);
end;
output;
end;
run;
proc format;
value yn 1='Yes' 2='No' 3='Maybe';
run;
data z(drop=x:) / view=z;
set x1;
a = put(x1 , yn5.);
b = put(x2 , yn5.);
c = put(x3 , yn5.);
d = put(x4 , yn5.);
e = put(x5 , yn5.);
f = put(x6 , yn5.);
g = put(x7 , yn5.);
h = put(x8 , yn5.);
i = put(x9 , yn5.);
j = put(x10, yn5.);
length k $ 1;
k = cats(mod(_n_, 5));
run;
%burt(data=z, vars=a b c d e f g h i j k)
MISSING VALUES:
Observations with missing value are excluded.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
This example uses the %Burt macro to create a Burt table from raw data. The table is then used as input to PROC CORRESP as an alternative to using the raw data. When you use VAR statement input and the MCA option, you need to specify the NVARS= option using the number of categorical variables that went into constructing the Burt matrix. The %Burt macro stores that value in the global macro variable _NVARS.
A small data is used so that you can compare the results from reading in both types of input.
%burt(data=sashelp.heart, vars=DeathCause Sex Chol_Status BP_Status Weight_Status Smoking_Status, out=burt) proc corresp data=burt short mca nvars=&_nvars; var _numeric_; run; proc corresp data=sashelp.heart short obs mca; tables DeathCause Sex Chol_Status BP_Status Weight_Status Smoking_Status; run;
Right-click on the link below and select Save to save the Burt macro definition to a file. It is recommended that you name the file burt.sas.
Type: | Sample |
Topic: | Analytics ==> Multivariate Analysis SAS Reference ==> Procedures ==> CORRESP |
Date Modified: | 2018-12-03 11:20:44 |
Date Created: | 2018-11-26 15:00:56 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS/STAT | z/OS | ||
z/OS 64-bit | ||||
OpenVMS VAX | ||||
Microsoft® Windows® for 64-Bit Itanium-based Systems | ||||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | ||||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | ||||
Microsoft Windows XP 64-bit Edition | ||||
Microsoft® Windows® for x64 | ||||
OS/2 | ||||
Microsoft Windows 8 Enterprise 32-bit | ||||
Microsoft Windows 8 Enterprise x64 | ||||
Microsoft Windows 8 Pro 32-bit | ||||
Microsoft Windows 8 Pro x64 | ||||
Microsoft Windows 8.1 Enterprise 32-bit | ||||
Microsoft Windows 8.1 Enterprise x64 | ||||
Microsoft Windows 8.1 Pro 32-bit | ||||
Microsoft Windows 8.1 Pro x64 | ||||
Microsoft Windows 10 | ||||
Microsoft Windows 95/98 | ||||
Microsoft Windows 2000 Advanced Server | ||||
Microsoft Windows 2000 Datacenter Server | ||||
Microsoft Windows 2000 Server | ||||
Microsoft Windows 2000 Professional | ||||
Microsoft Windows NT Workstation | ||||
Microsoft Windows Server 2003 Datacenter Edition | ||||
Microsoft Windows Server 2003 Enterprise Edition | ||||
Microsoft Windows Server 2003 Standard Edition | ||||
Microsoft Windows Server 2003 for x64 | ||||
Microsoft Windows Server 2008 | ||||
Microsoft Windows Server 2008 R2 | ||||
Microsoft Windows Server 2008 for x64 | ||||
Microsoft Windows Server 2012 Datacenter | ||||
Microsoft Windows Server 2012 R2 Datacenter | ||||
Microsoft Windows Server 2012 R2 Std | ||||
Microsoft Windows Server 2012 Std | ||||
Microsoft Windows Server 2016 | ||||
Microsoft Windows XP Professional | ||||
Windows 7 Enterprise 32 bit | ||||
Windows 7 Enterprise x64 | ||||
Windows 7 Home Premium 32 bit | ||||
Windows 7 Home Premium x64 | ||||
Windows 7 Professional 32 bit | ||||
Windows 7 Professional x64 | ||||
Windows 7 Ultimate 32 bit | ||||
Windows 7 Ultimate x64 | ||||
Windows Millennium Edition (Me) | ||||
Windows Vista | ||||
Windows Vista for x64 | ||||
64-bit Enabled AIX | ||||
64-bit Enabled HP-UX | ||||
64-bit Enabled Solaris | ||||
ABI+ for Intel Architecture | ||||
AIX | ||||
HP-UX | ||||
HP-UX IPF | ||||
IRIX | ||||
Linux | ||||
Linux for x64 | ||||
Linux on Itanium | ||||
OpenVMS Alpha | ||||
OpenVMS on HP Integrity | ||||
Solaris | ||||
Solaris for x64 | ||||
Tru64 UNIX |