When there are CLASS variables in the model, the ODS table ParameterEstimates produced by PROC SURVEYPHREG does not match any of the available CLASSVAR= formats that PROC MIANALYZE requires. However, with minimal code in a DATA step, the data set can be converted to a format that PROC MIANAYZE can readily use.
This example uses a data set from the NHANES/Epidemiologic Followup Study (NHEFS). For illustration purposes, only 100 observations are used to estimate regression coefficients of a proportional hazards model. An artificially constructed continuous variable, X, is also added to demonstrate the inclusion of a continuous covariate as a predictor. The observations are obtained from three strata. Each stratum contains either two or three primary sampling units.
data mortality; input ID VARSTRATA VARPSU SWEIGHT AGE VITALSTATUS POVARIND GENDER; x=rannor(123); datalines; 1 03 1 13312 66 1 1 1 2 03 1 7941 71 3 1 2 3 03 1 16048 . 4 1 1 4 03 3 9298 58 3 1 1 5 03 2 15336 56 3 1 2 6 03 1 14744 63 1 1 1 7 03 2 83729 70 1 2 2 8 03 3 106492 57 1 2 1 9 03 3 78083 81 3 2 2 10 03 3 55957 79 3 2 1 11 03 3 83729 68 1 2 2 12 03 1 78083 78 3 2 2 13 03 2 13824 78 1 1 2 14 03 3 13824 70 3 1 2 15 03 3 44649 50 1 1 2 16 03 1 9298 . 6 1 1 17 03 1 13824 77 1 1 2 18 03 3 4767 82 3 1 1 19 03 3 15336 56 3 1 2 20 03 3 16048 68 3 1 1 21 03 1 9298 74 1 1 1 22 03 2 14744 . 6 1 1 23 03 2 4767 77 3 1 1 24 03 2 16048 65 3 1 1 25 03 1 106492 61 1 2 1 26 03 3 170748 . 1 2 2 27 03 2 9298 . 1 1 1 28 03 1 78083 89 1 2 2 29 03 1 170748 58 1 2 2 30 03 2 20029 64 1 1 2 31 03 3 20029 63 1 1 2 32 03 1 32595 38 3 1 1 33 03 1 83729 70 1 2 2 34 03 2 110606 67 3 2 1 35 03 2 96469 77 1 2 2 36 03 3 55957 90 1 2 1 37 03 1 96469 69 3 2 2 38 03 2 106492 59 1 2 1 39 03 2 34328 50 1 1 2 40 03 2 13826 61 3 1 1 41 03 2 10466 72 1 1 2 42 03 2 21344 57 1 1 2 43 03 3 12059 78 1 1 2 44 03 2 9298 68 1 1 1 45 03 3 96469 71 3 2 2 46 08 3 5825 64 3 1 1 47 08 3 6656 58 3 1 1 48 08 3 2570 86 3 1 2 49 08 1 7282 49 1 1 2 50 08 2 6280 52 1 1 1 51 08 1 5825 66 1 1 1 52 08 2 7282 56 1 1 2 53 08 1 58254 51 1 2 2 54 08 2 68404 78 3 2 1 55 08 3 53246 64 1 2 1 56 08 1 7972 64 3 1 2 57 08 2 7282 50 1 1 2 58 08 1 50242 55 3 2 1 59 08 3 29377 81 3 2 1 60 08 3 29377 72 3 2 1 61 08 1 7106 75 1 1 2 62 08 1 2570 91 1 1 2 63 08 2 7972 83 1 1 2 64 08 1 8551 71 3 1 1 65 08 2 10413 . 1 1 2 66 08 3 46598 73 1 2 1 67 08 2 20558 78 3 2 2 68 08 1 20558 85 3 2 2 69 08 1 46598 67 1 2 1 70 08 3 83303 72 1 2 2 71 08 2 50242 47 1 2 1 72 08 3 68404 75 3 2 1 73 08 3 20558 88 3 2 2 74 08 1 63777 78 1 2 2 75 08 2 16725 75 3 2 2 76 08 2 70470 . 5 2 2 77 08 1 29377 80 3 2 1 78 08 1 53246 53 3 2 1 79 08 2 29377 78 3 2 1 80 08 3 70470 60 1 2 2 81 08 3 20558 89 1 2 2 82 08 1 56851 68 1 2 2 83 08 1 75098 65 1 2 2 84 08 1 68404 78 1 2 1 85 08 2 50242 52 1 2 1 86 08 1 63777 78 1 2 2 87 08 3 56851 71 1 2 2 88 11 1 113592 63 1 2 1 89 11 1 47843 86 1 2 1 90 11 1 113592 64 1 2 1 91 11 1 90096 87 3 2 2 92 11 1 99238 70 1 2 2 93 11 1 105885 85 1 2 2 94 11 1 77295 54 1 2 1 95 11 1 110393 . 4 2 2 96 11 1 110393 . 5 2 2 97 11 1 105237 66 3 2 1 98 11 2 47843 82 5 2 1 99 11 2 86027 65 6 2 1 100 11 2 12405 69 4 1 2 ;
Because AGE has missing values, PROC MI is invoked to perform multiple imputation using the monotone regression method.
proc mi data=mortality out=mort_imp seed=123 nimpute=5; class povarind gender vitalstatus; var povarind gender vitalstatus x age; monotone regression; run;
In the following statements, PROC SURVEYPHREG fits a proportional hazards model using two CLASS variables, POVARIND and GENDER, as predictors. The parameter estimates are saved in a data set using an ODS OUTPUT statement.
proc surveyphreg data = mort_imp; by _imputation_; class povarind gender; strata varstrata; cluster varpsu; weight sweight; model age*vitalstatus(1 4 5 6) = povarind gender x; hazardratio povarind; hazardratio gender; ods output ParameterEstimates=parms; run;
These statements display the saved data set of parameter estimates for the first imputation.
proc print data=parms; where _imputation_=1; id _imputation_; run;
|
This data set does not match any of the CLASSVAR= formats available in PROC MIANALYZE. But the variable PARAMETER does contain all the information that is needed to reformat it such that it matches the CLASSVAR=FULL format.
In order for PROC MIANALYZE to use this table it is necessary to create an EFFECT variable from the PARAMETER variable containing the model variable names in each row. The following DATA step uses the SCAN function to select the first word in the PARAMETER variable value to construct the EFFECT variable. It is again used to select the second word to construct the variables containing the model variable values. In order to avoid any issues with case-sensitivity, the UPCASE function is employed. The last ELSE statement in the series is for the continuous variable.
data parms_class; set parms; if upcase(scan(parameter,1))='POVARIND' then do; effect='POVARIND'; povarind=scan(parameter,2,' '); end; else if upcase(scan(parameter,1))='GENDER' then do; effect='GENDER'; gender=scan(parameter,2,' '); end; else effect=parameter; run;
These statements display the reformatted data set. Note that the new variable, EFFECT, contains the predictor values and the POVARIND and GENDER variables contain their levels. Together, these variables identify the parameter values in the ESTIMATE variable.
|
Finally, PROC MIANALYZE can be run using the CLASSVAR=FULL sub-option.
proc mianalyze parms(classvar=full)=parms_class; class povarind gender; modeleffects povarind gender x; run;
Because hazard ratios are often of interest in this type of model, it might be desirable to combine hazard ratio estimates. Because PROC SURVEYPHREG does not include standard errors for the hazard ratios, PROC MIANALYZE cannot combine them directly. Instead, it is necessary to use a DATA step to recompute the hazard ratio estimates and confidence limits from the combined parameter estimates and their confidence intervals.
These statements repeat the above PROC MIANALYZE analysis and save the combined parameter estimates and confidence intervals in a data set. The DATA step computes the hazard ratio estimates and confidence limits from the combined results and displays them using PROC PRINT.
proc mianalyze parms(classvar=full)=parms_class; class povarind gender; modeleffects povarind gender x; ods output ParameterEstimates=comb_parms; run; data comb_parms; set comb_parms; hr=exp(estimate); Lower=exp(lclmean); Upper=exp(uclmean); label hr="Hazard Ratio"; run; proc print data=comb_parms label; title 'Hazard Ratio Estimates'; id Parm Povarind Gender; var hr Lower Upper; run;
The following table displays the combined hazard ratio estimates.
|
Product Family | Product | System | SAS Release | |
Reported | Fixed* | |||
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 |
Type: | Usage Note |
Priority: | |
Topic: | Analytics ==> Missing Value Imputation Analytics ==> Survey Sampling and Analysis Analytics ==> Survival Analysis SAS Reference ==> Procedures ==> MIANALYZE SAS Reference ==> Procedures ==> MI SAS Reference ==> Procedures ==> SURVEYPHREG |
Date Modified: | 2018-11-29 09:08:23 |
Date Created: | 2018-11-27 10:39:44 |