Examining model stability, an example

Slides:



Advertisements
Similar presentations
Outline Proc Report Tricks Kelley Weston. Outline Examples 1.Text that spans columnsText that spans columns 2.Patient-level detail in the titlesPatient-level.
Advertisements

SAS Programming Techniques for Decoding Variables on the Database Level By Chris Speck PAREXEL International RTSUG – Wednesday, March 23, 2011.
MASUG December 5, Agenda Announcements Announcements Tips & Tricks Tips & Tricks Presentation: Presentation: Working Smarter, Not Harder with DDE:
Assignmnet: Simple Random Sampling With Replacement Some Solutions.
Introduction to SQL Session 1 Retrieving Data From a Single Table.
Basic And Advanced SAS Programming
Let SAS Do the Coding for You! Robert Williams Business Info Analyst Sr. WellPoint Inc.
Automating survey data validation using SAS macros Eric Bush, DVM, MS Centers for Epidemiology and Animal Health Fort Collins, CO.
Data Cleaning 101 Ron Cody, Ed.D Robert Wood Johnson Medical School Piscataway, NJ.
Data Preparation for Analytics Using SAS Gerhard Svolba, Ph.D. Reviewed by Madera Ebby, Ph.D.
“SAS macros are just text substitution!” “ARRRRGGHHH!!!”
Computing for Research I Spring 2014 January 22, 2014.
SAS SQL SAS Seminar Series
Chapter 10:Processing Macro Variables at Execution Time 1 STAT 541 © Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
Chapter 9 Producing Descriptive Statistics PROC MEANS; Summarize descriptive statistics for continuous numeric variables. PROC FREQ; Summarize frequency.
Different Decimal Places For Different Laboratory Tests PharmaSug 2004, TT01 A. Cecilia Mauldin.
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
1 SAS 1-liners SAS Coding Efficiencies. 2 Overview Less is more Always aim for robust, reusable and efficient code Coding efficiency versus processing.
Grant Brown.  AIDS patients – compliance with treatment  Binary response – complied or no  Attempt to find factors associated with better compliance.
Manage Variable Lists with Macro Variables 1 for Improved Readability and Modifiability.
1 Unknown Knowns: Database Construction from Unknown Files and Variables William Klein.
1 Efficient SAS Coding with Proc SQL When Proc SQL is Easier than Traditional SAS Approaches Mike Atkinson, May 4, 2005.
Macro Variable Resolution Enio Presutto York University, Toronto, Canada.
Copyright © 2006, SAS Institute Inc. All rights reserved. A Sampler of What's New in Base SAS 9.2
1 Using the Magical Keyword “INTO” in PROC SQL Thiru Satchi Blue Cross and Blue Shield of Massachusetts Boston Area SAS Users Group April 5, 1999.
Tips & Tricks From your fellow SAS users 9/30/2004.
Lesson 8 - Topics Creating SAS datasets from procedures Using ODS and data steps to make reports Using PROC RANK Programs in course notes LSB 4:11;5:3.
Copyright © 2004, SAS Institute Inc. All rights reserved. SASHELP Datasets A real life example Barb Crowther SAS Consultant October 22, 2004.
Testing Significance of coefficients Usually, first examination of model Does the model including the independent variable provide significantly more information.
Patrick Thornton SRI International.  Example of a Multiple Response Item ◦ Variable coding and example data  A Cross Tabulation using Proc REPORT 
Longitudinal Data Techniques: Looking Across Observations Ronald Cody, Ed.D., Robert Wood Johnson Medical School.
Session 1 Retrieving Data From a Single Table
Command Line Arguments
SAS Macro Language.
Two “identical” programs
Basic Queries Specifying Columns
An Introduction to SQL.
Creating Macro Variables in SQL (Review)
Conditional Processing
Lesson 11 - Topics Statistical procedures: PROC LOGIST, REG
3 Macro Parameters.
Creating the Example Data
Quick Data Summaries in SAS
Coding Concepts (Data Structures)
Demonstrating the Linear Model
Defining and Calling a Macro
Complete Case Macro.
How to Create Data Driven Lists
Retrieving Macro Variables in the DATA Step
3 Iterative Processing.
Bring the Vampire out of the Shadows: Understanding the RETAIN and COUNT functions in SAS® Steve Black.
Hunter Glanz & Josh Horstman
Create a subset of DPC data
Program Testing and Performance
Meta-Analysis Glass (Education Researcher, 5:3-8; 1976) suggested that there were three types of analyses: Primary analysis tests the hypothesis for.
Combining Data Sets in the DATA step.
3 Parameter Validation.
Never Cut and Paste Again
Let’s Talk About Variable Attributes
Producing Descriptive Statistics
3 Specifying Rows.
Example, Create an analytic file for Nhanes 1999
Trigger %macro check_trigger_run;
Framingham, Exam 5 subset
Passing Simple and Complex Parameters In and Out of Macros
Introduction to Subqueries, An Example
Fixed Effects estimate using person level data
Remerging Summary Values
Data tmp; do i=1 to 10; output; end; run; proc print data=tmp;
Frank DiIorio CodeCrafters, Inc. Philadelphia PA
Presentation transcript:

Examining model stability, an example proc logistic data=s5238.chd5238 outest=betas; model chd10yr(event="1")=age male sbp chol diab currsmok/ selection=forward; run; proc print data=betas;run;

Select 100 bootstrap samples %bootsamp(indat=s5238.chd5238,outdat=outboot,reps=100,seed=3759543);

Re-do analysis for each bootstrap sample proc logistic data=outboot outest=betas noprint; by replicate; model chd10yr(event="1")=age male sbp chol diab currsmok/ selection=forward; run; proc print data=betas;run;

A simple summary. proc means data=betas; var age male sbp chol diab currsmok; run;

Another summary – create a string that is six characters long Another summary – create a string that is six characters long. Each character is 0 or 1. The first character is 1 if the first variable is in the model, 0 if it is not. The same for the other two characters.

%macro zeroone(indat=,outdat=models,newvar=model,vars=); %let numvars=%sysfunc(countw(&vars)); data &outdat; length &newvar $ &numvars..; set &indat; array t{&numvars} &vars; do i=1 to &numvars; substr(&newvar,i,1)=put((t{i} ne .),1.); end; run; %mend;

%zeroone(indat=betas,outdat=models,newvar=model,vars= age male sbp chol diab currsmok); proc freq data=models; table model; run;

A much more complex model A much more complex model. Lots of interaction terms, no hierarchical model restrictions. proc logistic data=s5238.chd5238 outest=betas descending ; model chd10yr=age | male | chol | sbp | bmi | diab | currsmok / selection=forward slentry=.1 hierarchy=none;/*single is default*/ run;

Do the complex model on the bootstrap samples. proc logistic data=outboot outest=betas descending noprint; by replicate; model chd10yr=age | male | chol | sbp | bmi | diab | currsmok / selection=forward slentry=.1 hierarchy=none;/*single is default*/ run;

The problem -- Lots of variable names. %zeroone(indat=betas,outdat=models,newvar=model,vars= age male sbp chol diab currsmok); proc contents data=betas; run;

Use SQL to put variables names into a macro variable proc sql; select name into :varnames separated by " " from dictionary.columns where libname="WORK" and memname="BETAS" and type="num" and lowcase(name) ne "replicate" and lowcase(name) ne "intercept" and name ne "_LNLIKE_" ; quit; %let numvars=%sysfunc(countw("&varnames")); %put &numvars; %put &varnames;

Now use the zeroone macro %zeroone(indat=betas,outdat=models1,newvar=model,vars=&varnames); proc sql; create table nummodels as select distinct model from models1 ; select count(*) "Number of distinct models" from nummodels quit;