syntax for calling macro and sample output
/* HEADING */
/* This program is used to test WilGoonessFit.sas macro */
filename crd '/udd/nhron/macrodevelopment/WilcxRank/data/IlluminaSQNM.prn';
libname inflb '/udd/nhron/macrodevelopment/WilcxRank/data';
OPTIONS PAGESIZE = 60 LINESIZE = 100 PAGENO = 1 date formdlim=']';
*options symbolgen mprint;
options yearcutoff=1920;
footnote '/udd/nhron/macrodevelopment/WilcxRank/testWilgoodnessfit.sas';
proc format;
value ag 1='< 60' 2='60-69' 3='70-79' 4='80+';
value ag1f 1='< 60-69' 2='70-95' ;
value bm 1='<25.0' 2='25.0-29.9' 3='30.0+';
value sx 1='Male' 2='Female';
run;
data sqnm;
infile crd firstobs=2;
input sbj_uid 2-11 @73 rs1061170 $char3.;
run;
proc sort; by sbj_uid;
data ids;
set inflb.illuminastudyids end=eof;
retain fam twn prog regg areds 0;
if fhid ne ' ' then fam=fam+1;
if meeiid ne ' ' then areds=areds+1;
if pstudyidwop ne ' ' then prog=prog+1;
if rstudyidwor ne ' ' then regg=regg+1;
if sbj_twn_caseid ne ' ' then twn=twn+1;
if eof then put fam= areds= prog= regg= twn= ;
run;
proc sort; by sbj_uid;
data amdgrd;
set inflb.origgradelist;
run;
proc sort; by sbj_uid;
data demog;
set inflb.jsdb_sbj_subjects;
run;
proc sort; by sbj_uid;
data all;
merge ids(in=ia) amdgrd(in=ib) demog(in=ic) sqnm(in=ie); by sbj_uid;
if ia and ib and ic and ie;
run;
proc sort; by pstudyidwop;
/* reading the genotyping data */
proc import out=aredsphenotype1
datafile="/udd/nhron/macrodevelopment/WilcxRank/data/AREDS_phenotype_072605.csv"
dbms=dlm replace;
delimiter=',';
getnames=yes;
run;
proc import out=aredsphenotype2
datafile="/udd/nhron/macrodevelopment/WilcxRank/data/AREDS_phenotype_072905.csv"
dbms=dlm replace;
delimiter=',';
getnames=yes;
run;
data aredsphenotype2(drop=Baseline_Age Age_at_Last_Photos);
set aredsphenotype2;
where Obs^=.;
f1=input(Baseline_Age,8.);
f2=input(Age_at_Last_Photos,8.);
run;
data aredsphenotype2;
set aredsphenotype2;
rename f1=Baseline_Age
f2=Age_at_Last_Photos;
run;
proc sort data=aredsphenotype1;
by specimen_number;
run;
proc sort data=aredsphenotype2;
by specimen_number;
run;
data mergeemmes;
set aredsphenotype1 aredsphenotype2;
by specimen_number;
run;
proc import out=newemmesgrades
datafile="/udd/nhron/macrodevelopment/WilcxRank/data/AREDS_EMMES_revised_phenotype_20051122.csv"
dbms=dlm replace;
delimiter=',';
getnames=yes;
run;
data newemmesgrades(drop=obs
rename=(specimen_number=specimen_number_new));
set newemmesgrades;
run;
proc sql;
create table newmergeemmes as select mergeemmes.*, newemmesgrades.*
from mergeemmes left join newemmesgrades on
mergeemmes.specimen_number=newemmesgrades.specimen_number_new;
run;
proc import out=sqnm
datafile="/udd/nhron/macrodevelopment/WilcxRank/data/Broad_Illumina_SQNM_results_20050728.csv"
dbms=dlm replace;
delimiter=',';
getnames=yes;
run;
proc sort data=sqnm;
by individual_id;
run;
proc sql;
create table emmesaredstemp as select sqnm.*, newmergeemmes.* from
sqnm left join newmergeemmes on sqnm.individual_id=newmergeemmes.specimen_number;
run;
data emmesareds;
set emmesaredstemp;
where specimen_number^="";
/* note: missing some last photo dates because of formatting issue above */
*mostrecent_grade=current_amd_category;
smokstat=baseline_smoking_status;
age_recent=Current_Age;
if smokstat='Former' then smokstat='PAST';
if smokstat='Current' then smokstat='CURRENT';
if smokstat='Never' then smokstat='NEVER';
if sex='M' then ssex=1;
if sex='F' then ssex=2;
if . < baseline_bmi < 25.0 then bmigp=1;
else if 25.0 <= baseline_bmi < 30.0 then bmigp=2;
else if 30.0 <= baseline_bmi then bmigp=3;
format ethnic $20.;
ethnic=race;
drop sex race;
run;
/* EMMES AREDS data */
data emmesareds;
set emmesareds;
/* calculate education variables */
/* education: lowest common denominator of text education categories */
format education2 $60.;
education2=education;
if education="Some College or Associate Degree"
then education2="Some College or Associate Degree or Vocational Training";
if education="Bachelor's Degree" then education2="College Degree";
if education="Postgraduate Work" then education2="Graduate Work";
/* highsch: 0=less than high school, 1=high school or more */
if education2="Grade 11 or Less" then highsch=0;
if education2 in ("High School Graduate","Some College or Associate Degree or Vocational Training",
"College Degree","Graduate Work") then highsch=1;
/* highsch2: 0=high school or less, 1=more than high school */
if education2 in ("Grade 11 or Less","High School Graduate") then highsch2=0;
if education2 in ("Some College or Associate Degree or Vocational Training",
"College Degree","Graduate Work") then highsch2=1;
/* educatnum: numerical assignation to all all text categories */
format educatnum 3.;
if education="Grade 11 or Less" then educatnum=11;
if education="High School Graduate" then educatnum=12;
if education="Some College or Associate Degree" then educatnum=14;
if education="Bachelor's Degree" then educatnum=16;
if education="Postgraduate Work" then educatnum=17;
emmeseducation=education;
rename education2=education Age_at_Last_Photos=Age_at_Last_Visit ssex=gender;
label Age_at_Last_Photos="Age at Last Visit" ssex=gender;
drop education;
run;
data emmesareds2;
set emmesareds;
mostrecent_grade=MEEI_Current_AMD_category;
Age_at_Last_Photos=Age_at_Last_Visit;
if . < baseline_bmi < 25.0 then base_bmigp=1;
else if 25.0 <= baseline_bmi < 30.0 then base_bmigp=2;
else if 30.0 <= baseline_bmi then base_bmigp=3;
if . < Current_bmi < 25.0 then current_bmigp=1;
else if 25.0 <= Current_bmi < 30.0 then current_bmigp=2;
else if 30.0 <= Current_bmi then current_bmigp=3;
if . < Baseline_Age < 70 then base_agegrp=1;
else if 70 <= Baseline_Age < 95 then base_agegrp=2;
if . < Age_at_Last_Photos < 60 then photo_agegrp=1;
else if 60 <= Age_at_Last_Photos < 70 then photo_agegrp=2;
else if 70 <= Age_at_Last_Photos < 80 then photo_agegrp=3;
else if 80 <= Age_at_Last_Photos < 95 then photo_agegrp=4;
if . < age_recent < 60 then current_agegrp=1;
else if 60 <= age_recent < 70 then current_agegrp=2;
else if 70 <= age_recent < 80 then current_agegrp=3;
else if 80 <= age_recent < 95 then current_agegrp=4;
if rs1061170=0 then delete;
if mostrecent_grade=2 or mostrecent_grade=3 then delete;
if gender='2' then gender=0;
if base_bmigp=1 then bmilt25=1; else bmilt25=0;
if base_bmigp=2 then bmi2529=1; else bmi2529=0;
if base_bmigp=3 then bmi30=1; else bmi30=0;
if base_bmigp=2 or base_bmigp=3 then bmi25=1; else bmi25=0;
if base_bmigp=1 or base_bmigp=2 then bmilt30=1; else bmilt30=0;
if base_agegrp=2 then bage7079=1; else bage7079=0;
if rs1061170=44 then genotp=0;
else if rs1061170=24 then genotp=1;
else if rs1061170=22 then genotp=2;
if genotp=1 then genotp24=1; else genotp24=0;
if genotp=2 then genotp22=1; else genotp22=0;
if genotp=0 then genotp44=1; else genotp44=0;
if smokstat='CURRENT' then smkcur=1; else smkcur=0;
if smokstat='PAST' then smkpst=1; else smkpst=0;
if mostrecent_grade=1 then cascnt=0;
else if mostrecent_grade=4 or mostrecent_grade=5 then cascnt=1;
if Took_Centrum_During_Study_='N' then centrum=0;
else if Took_Centrum_During_Study_='Y' then centrum=1;
if AREDS_Treatment='Zinc' then zinc=1; else zinc=0;
if AREDS_Treatment='Antiox+Zinc' then antzinc=1; else antzinc=0;
if AREDS_Treatment='Antioxidants' then antiox=1; else antiox=0;
if AREDS_Treatment='Antiox+Zinc' or AREDS_Treatment='Antioxidants'
then antioxidant=1; else antioxidant=0;
if smkcur=1 or smkpst=1 then smkevr=1;
if smkcur=0 and smkpst=0 then smkevr=0;
if smkcur=0 and smkpst=0 then smknvr=1; else smknvr=0;
age_geno24=bage7079*genotp24;
age_geno22=bage7079*genotp22;
age_geno44=bage7079*genotp44;
age_genotp=bage7079*genotp;
sex_geno24=gender*genotp24;
sex_geno22=gender*genotp22;
sex_geno44=gender*genotp44;
sex_genotp=gender*genotp;
hisch_geno24=highsch*genotp24;
hisch_geno22=highsch*genotp22;
hisch_geno44=highsch*genotp44;
hisch_genotp=highsch*genotp;
bmilt25_geno24=bmilt25*genotp24;
bmilt25_geno22=bmilt25*genotp22;
bmilt25_geno44=bmilt25*genotp44;
bmilt30_geno24=bmilt30*genotp24;
bmilt30_geno22=bmilt30*genotp22;
bmilt30_geno44=bmilt30*genotp44;
bmi2529_geno24=bmi2529*genotp24;
bmi2529_geno22=bmi2529*genotp22;
bmi2529_geno44=bmi2529*genotp44;
bmi2529_genotp=bmi2529*genotp;
bmi30_geno24=bmi30*genotp24;
bmi30_geno22=bmi30*genotp22;
bmi30_geno44=bmi30*genotp44;
bmi30_genotp=bmi30*genotp;
bmi25_geno24=bmi25*genotp24;
bmi25_geno22=bmi25*genotp22;
bmi25_geno44=bmi25*genotp44;
bmi25_genotp=bmi25*genotp;
smkcur_geno24=smkcur*genotp24;
smkcur_geno22=smkcur*genotp22;
smkcur_genotp=smkcur*genotp;
smkpst_geno24=smkpst*genotp24;
smkpst_geno22=smkpst*genotp22;
smkpst_genotp=smkpst*genotp;
smknvr_geno24=smknvr*genotp24;
smknvr_geno22=smknvr*genotp22;
smknvr_geno44=smknvr*genotp44;
smkevr_geno24=smkevr*genotp24;
smkevr_geno22=smkevr*genotp22;
smkevr_geno44=smkevr*genotp44;
smkevr_genotp=smkevr*genotp;
if ethnic='White';
run;
proc format;
value ag 1='50-59' 2='60-69' 3='70-79' 4='80-95';
value bmi 1='<25.0' 2='25.0-29.9' 3='30.0+';
run;
title 'Grade 4 & 5 vs. Controls';
*proc logistic descending;
*model cascnt=bage7079 gender highsch genotp24 genotp22;
run;
*proc logistic descending;
*model cascnt=bage7079 gender highsch genotp24 genotp22
bmi2529 bmi30 smkcur smkpst ;
run;
data model1;
set emmesareds2;
if cascnt=1 then events=1;
else if cascnt=0 then events=0;
/* From logistic regression above */
a=0.6104;
b1=1.0911;
b2=-0.2749;
b3=-0.8444;
b6=0.2538;
b7=0.6764;
b8=1.4599;
b9=0.4212;
score1=a+b1*bage7079+b2*gender+b3*highsch
+b6*bmi2529+b7*bmi30+b8*smkcur+b9*smkpst;
a=-0.5265;
b1=1.1260;
b2=-0.3102;
b3=-0.6727;
b4=0.9770;
b5=2.0078;
b6=0.1261;
b7=0.7190;
b8=1.6256;
b9=0.5023;
score2=a+b1*bage7079+b2*gender+b3*highsch+b4*genotp24
+b5*genotp22+b6*bmi2529+b7*bmi30+b8*smkcur+b9*smkpst;
run;
data model2;
set emmesareds2;
if cascnt=1 then events=1;
else if cascnt=0 then events=0;
a=0.2270;
b1=1.0501;
b2=-0.1966;
b3=-0.7446;
b4=0.8174;
b5=1.8914;
score1=a+b1*bage7079+b2*gender+b3*highsch+b4*genotp24+b5*genotp22;
a=-0.5265;
b1=1.1260;
b2=-0.3102;
b3=-0.6727;
b4=0.9770;
b5=2.0078;
b6=0.1261;
b7=0.7190;
b8=1.6256;
b9=0.5023;
score2=a+b1*bage7079+b2*gender+b3*highsch+b4*genotp24
+b5*genotp22+b6*bmi2529+b7*bmi30+b8*smkcur+b9*smkpst;
run;
%include "WilGoodnessFit.sas";
%WilGoodnessFit(maindsn=model1, outcome=events, subgrp=base_agegrp,id=individual_id);
Output:
Grade 4 & 5 vs. Controls 10:12 Monday, March 3, 2008 2
------------------------------------------ base_agegrp=1 -------------------------------------------
The CORR Procedure
2 Variables: probit_a probit_b
Simple Statistics
Variable N Mean Std Dev Sum Minimum Maximum
probit_a 285 0.17417 0.97058 49.63936 -2.19015 2.87243
probit_b 285 0.31192 0.93992 88.89717 -1.83027 2.74182
Pearson Correlation Coefficients, N = 285
Prob > |r| under H0: Rho=0
probit_a probit_b
probit_a 1.00000 0.64005
<.0001
probit_b 0.64005 1.00000
<.0001
/udd/nhron/macrodevelopment/WilcxRank/testWilgoodnessfit.sas
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
Grade 4 & 5 vs. Controls 10:12 Monday, March 3, 2008 3
------------------------------------------ base_agegrp=2 -------------------------------------------
The CORR Procedure
2 Variables: probit_a probit_b
Simple Statistics
Variable N Mean Std Dev Sum Minimum Maximum
probit_a 289 0.11795 0.96609 34.08679 -1.99014 2.77741
probit_b 289 0.18327 0.92935 52.96450 -2.54401 2.77741
Pearson Correlation Coefficients, N = 289
Prob > |r| under H0: Rho=0
probit_a probit_b
probit_a 1.00000 0.56860
<.0001
probit_b 0.56860 1.00000
<.0001
/udd/nhron/macrodevelopment/WilcxRank/testWilgoodnessfit.sas
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
Grade 4 & 5 vs. Controls 10:12 Monday, March 3, 2008 4
------------------------------------------ base_agegrp=1 -------------------------------------------
The CORR Procedure
2 Variables: probit_a probit_b
Simple Statistics
Variable N Mean Std Dev Sum Minimum Maximum
probit_a 205 -0.23374 0.94006 -47.91669 -2.19015 2.28346
probit_b 205 -0.43153 0.88212 -88.46325 -2.45073 2.45073
Pearson Correlation Coefficients, N = 205
Prob > |r| under H0: Rho=0
probit_a probit_b
probit_a 1.00000 0.50185
<.0001
probit_b 0.50185 1.00000
<.0001
/udd/nhron/macrodevelopment/WilcxRank/testWilgoodnessfit.sas
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
Grade 4 & 5 vs. Controls 10:12 Monday, March 3, 2008 5
------------------------------------------ base_agegrp=2 -------------------------------------------
The CORR Procedure
2 Variables: probit_a probit_b
Simple Statistics
Variable N Mean Std Dev Sum Minimum Maximum
probit_a 75 -0.43326 0.87768 -32.49484 -1.99014 1.29732
probit_b 75 -0.70387 0.87621 -52.79046 -2.54401 1.38151
Pearson Correlation Coefficients, N = 75
Prob > |r| under H0: Rho=0
probit_a probit_b
probit_a 1.00000 0.50165
<.0001
probit_b 0.50165 1.00000
<.0001
/udd/nhron/macrodevelopment/WilcxRank/testWilgoodnessfit.sas
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
Both models 10:12 Monday, March 3, 2008 6
Defference
base_ # of # of Theta +/- se Theta +/- se of Theta from
Obs agegrp Cases Controls for model1 for model2 2 models
1 1 285 205 0.607+/-0.026 0.725+/-0.023 -0.118+/-0.023
2 2 289 75 0.657+/-0.035 0.759+/-0.031 -0.102+/-0.033
/udd/nhron/macrodevelopment/WilcxRank/testWilgoodnessfit.sas
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
Both models 10:12 Monday, March 3, 2008 7
# of # of Theta +/- se Theta +/- se Defference of
Cases Controls for model1 for model2 Theta from 2
Obs Summary Summary Summary Summary models Summary pvalue
1 574 280 0.624+/- 0.021 0.737+/- 0.018 -0.113+/- 0.019 2.2186E-9
/udd/nhron/macrodevelopment/WilcxRank/testWilgoodnessfit.sas
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
Both models 10:12 Monday, March 3, 2008 9
------------------------------------------ base_agegrp=1 -------------------------------------------
The CORR Procedure
2 Variables: probit_a probit_b
Simple Statistics
Variable N Mean Std Dev Sum Minimum Maximum
probit_a 285 0.26467 0.91999 75.43050 -1.58920 2.35888
probit_b 285 0.31192 0.93992 88.89717 -1.83027 2.74182
Pearson Correlation Coefficients, N = 285
Prob > |r| under H0: Rho=0
probit_a probit_b
probit_a 1.00000 0.78802
<.0001
probit_b 0.78802 1.00000
<.0001
/udd/nhron/macrodevelopment/WilcxRank/testWilgoodnessfit.sas
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
Both models 10:12 Monday, March 3, 2008 10
------------------------------------------ base_agegrp=2 -------------------------------------------
The CORR Procedure
2 Variables: probit_a probit_b
Simple Statistics
Variable N Mean Std Dev Sum Minimum Maximum
probit_a 289 0.13732 0.92075 39.68610 -1.65153 2.13359
probit_b 289 0.18327 0.92935 52.96450 -2.54401 2.77741
Pearson Correlation Coefficients, N = 289
Prob > |r| under H0: Rho=0
probit_a probit_b
probit_a 1.00000 0.81173
<.0001
probit_b 0.81173 1.00000
<.0001
/udd/nhron/macrodevelopment/WilcxRank/testWilgoodnessfit.sas
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
Both models 10:12 Monday, March 3, 2008 11
------------------------------------------ base_agegrp=1 -------------------------------------------
The CORR Procedure
2 Variables: probit_a probit_b
Simple Statistics
Variable N Mean Std Dev Sum Minimum Maximum
probit_a 205 -0.35401 0.84019 -72.57224 -1.58920 1.93530
probit_b 205 -0.43153 0.88212 -88.46325 -2.45073 2.45073
Pearson Correlation Coefficients, N = 205
Prob > |r| under H0: Rho=0
probit_a probit_b
probit_a 1.00000 0.82457
<.0001
probit_b 0.82457 1.00000
<.0001
/udd/nhron/macrodevelopment/WilcxRank/testWilgoodnessfit.sas
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
Both models 10:12 Monday, March 3, 2008 12
------------------------------------------ base_agegrp=2 -------------------------------------------
The CORR Procedure
2 Variables: probit_a probit_b
Simple Statistics
Variable N Mean Std Dev Sum Minimum Maximum
probit_a 75 -0.51371 0.82337 -38.52851 -1.65153 1.15871
probit_b 75 -0.70387 0.87621 -52.79046 -2.54401 1.38151
Pearson Correlation Coefficients, N = 75
Prob > |r| under H0: Rho=0
probit_a probit_b
probit_a 1.00000 0.80816
<.0001
probit_b 0.80816 1.00000
<.0001
/udd/nhron/macrodevelopment/WilcxRank/testWilgoodnessfit.sas
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
Both models 10:12 Monday, March 3, 2008 13
Defference
base_ # of # of Theta +/- se Theta +/- se of Theta from
Obs agegrp Cases Controls for model1 for model2 2 models
1 1 285 205 0.689+/-0.024 0.725+/-0.023 -0.036+/-0.016
2 2 289 75 0.695+/-0.034 0.759+/-0.031 -0.063+/-0.021
/udd/nhron/macrodevelopment/WilcxRank/testWilgoodnessfit.sas
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
Both models 10:12 Monday, March 3, 2008 14
# of # of Theta +/- se Theta +/- se Defference of
Cases Controls for model1 for model2 Theta from 2
Obs Summary Summary Summary Summary models Summary pvalue
1 574 280 0.691+/- 0.020 0.737+/- 0.018 -0.046+/- 0.013 .000304654
/udd/nhron/macrodevelopment/WilcxRank/testWilgoodnessfit.sas