********************************************************* * MAC / iOS version * * Rescoring DCCS, Flanker, PSM, and Pattern Comparison * and calculating normative and composite scores * using these rescored values * * FOR USE ONLY WITH NIH TOOLBOX IPAD DATA EXPORTS PRIOR TO * RESCORING UPDATE (insert date of app update) * * February 2016 ***********************************************************; ***********************************************************; * INPUT: You will need to supply the file path and file * names for three data export csv files as inputs * to the macro call. Exported files will be named * similar to these listed below, however you may * have saved them under different names: * * 1. YYYY-MM-DD XX.XX.XX Registration Data.csv * 2. YYYY-MM-DD XX.XX.XX Assessment Scores.csv * 3. YYYY-MM-DD XX.XX.XX Assessment Data.csv * * * OUTPUT: a SAS dataset in the WORK directory, named * 'Final' that you should save to a permanent * location of your choosing or export to your * preferred file format ***********************************************************; ** Example macro call (place your path and filenames in the macro call at the very bottom of this program, you do not need to change anything else); %TBrescore(path=H:/Toolbox/iPad/SAS Rescoring program, reg=2017-01-17 11.00.15 Registration Data, scores=2017-01-17 11.00.15 Assessment Scores, assessment=2017-01-17 11.00.15 Assessment Data); %macro TBrescore(path=, reg=, scores=, assessment=); ** Import and process registration file **; proc import file="&path/®..csv" out=reg dbms=csv replace; run; data reg; set reg; if gender in (1 2) then Male=(gender=1); if age ge 18 then do; if band(Race, 2)>0 then Group="B"; else if Ethnicity=2 then Group="H"; else if band(Race, 1)>0 or band(Race, 4)>0 then Group="W"; else if Race ne 64 then Group="B"; Edu=Education; end; else if . < age < 18 then do; if ((band(Race, 1)>0) + (band(Race, 2)>0) + (band(Race, 4)>0) + (band(Race, 8)>0) + (band(Race, 16)>0) + (band(Race,32)>0)) > 1 then Group="M"; else if Race=2 then Group="B"; else if Ethnicity=2 then Group="H"; else if Race=1 or Race=4 then Group="W"; else if Race in (8 32) then Group="B"; Edu=MothersEducation; if Edu=. then Edu=FathersEducation; if Edu=. then Edu=GuardiansEducation; end; if Edu in (1 2 3) then edu_yrs=0; else if 4 le Edu le 14 then edu_yrs=Edu-3; else if Edu in (16 18) then edu_yrs=12; *else if Edu=17 then edu_yrs=11; else if Edu in (25 26) then edu_yrs=13; else if Edu in (20 27) then edu_yrs=14; else if Edu=28 then edu_yrs=13; else if Edu=21 then edu_yrs=16; else if Edu=22 then edu_yrs=18; else if Edu in (23 24) then edu_yrs=20; keep PIN Name Age edu_yrs male Group; run; proc sort data=reg nodup; by PIN Name; run; ** Import and process scores file **; proc import file="&path/&scores..csv" out=scores dbms=csv replace; run; data scores; set scores; length Short $12.; if find(Inst, '(experimental)', 'i')>0 or find(Inst, 'Crystallized', 'i')>0 or find(Inst, 'Childhood', 'i')>0 or find(Inst, 'Fluid', 'i')>0 or find(Inst, 'Total Composite', 'i')>0 then delete; if find(Inst, 'Dimensional', 'i')>0 then Short="DCCS"; if find(Inst, 'Flanker', 'i')>0 then Short="Flanker"; if find(Inst, 'Sorting', 'i')>0 then Short="ListSort"; if find(Inst, 'Reading', 'i')>0 then Short="EngRead"; if find(Inst, 'Pattern', 'i')>0 then Short="PatternComp"; if find(Inst, 'Sequence', 'i')>0 then Short="PSM"; if find(Inst, 'Vocabulary', 'i')>0 then Short="EngVocab"; if Short="" then delete; Theta_n=Theta*1; rename RawScore=Raw Computed_Score=Computed Uncorrected_Standard_Score=Uncorr Age_Corrected_Standard_Score=AgeCorr Fully_Corrected_T_score=FullT Theta_n=Theta; keep PIN Assessment_Name Short RawScore Theta_n Computed_Score Uncorrected_Standard_Score Age_Corrected_Standard_Score Fully_Corrected_T_score; run; proc sort data=scores nodupkey; by pin Assessment_Name Short; run; ** MultiTranspose macro **; * _\|/_ (o o) +----oOO-{_}-OOo----------------------------------------------------------------------------+ : : : MultiTranspose (version 1.0.3, February 2011) : : : : Transposing multiple variables in a data set : : : : http://www.medicine.mcgill.ca/epidemiology/Joseph/PBelisle : +--------------------------------------------------------------------------------------------; %macro MultiTranspose(out=, data=, vars=, by=, pivot=, copy=, dropMissingPivot=1, UseNumericExt=0, library=library); %local dsCandidateVarnames dsContents dsCopiedVars dsLocalOut dsNewVars dsNewVarsFreq dsPivotLabels dsPivotLabelsHigh dsPivotLabelsLow dsPivotLabelsOther dsPivotObsValues dsRowvarsFreq dsTmp dsTmpOut dsTransposedVars dsXtraVars; %local anyfmtHigh anyfmtLow anyfmtOther anymissinglabel anymissingPivotlabel anyrepeatedvarname byfmt bylbl byvar datefmt; %local formatl formattedPivot i llabel lmax lPivotlabel lPivotmylabel; %local nbyvars ncandidatevars ncopy newlbl newvar newvars nNewvars npivot npivotvalues nvars; %local pivotfmt pivotIsDate pivotIsNumeric pivotvalue s tmp tmpvar; %local v var vars xnewvars xtravar ynewvars; /* PIVOT names the column in the input file whose row values provide the column names in the output file. There should only be one variable in the PIVOT statement. Also, the column used for the PIVOT statement cannot have any duplicate values (for a given set of values taken by variables listed in BY) */; * Check that mandatory arguments were filled; %if %length(%superq(out)) eq 0 %then %do; %put ERROR: [MultiTranspose] output file must be specified (through out= argument); %goto Farewell; %end; %if %length(%superq(data)) eq 0 %then %do; %put ERROR: [MultiTranspose] input data set must be specified (through data= argument); %goto Farewell; %end; %if %length(%superq(vars)) eq 0 %then %do; %put ERROR: [MultiTranspose] list of variables to be transposed must be specified (through vars= argument); %goto Farewell; %end; %if %length(%superq(by)) eq 0 %then %do; %put ERROR: [MultiTranspose] *by* variables must be specified (through by= argument); %goto Farewell; %end; %if %length(%superq(pivot)) eq 0 %then %do; %put ERROR: [MultiTranspose] pivot variable must be specified (through pivot= argument); %goto Farewell; %end; %let nbyvars = %MultiTransposeNTokens(&by); %let npivot = %MultiTransposeNTokens(&pivot); * ~~~ First make sure that no duplicate (in variables by * pivot) is found in source data set ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~; %if &npivot ne 1 %then %do; %put ERROR: [MultiTranspose] one and only one variable name must be given in *pivot* argument; %goto Farewell; %end; %let dsCandidateVarnames = %MultiTransposeNewDatasetName(candidatevarnames); %let ncandidatevars = %sysevalf(&nbyvars+2); data &dsCandidateVarnames; retain found 0; length vname $ 32; do i = 1 to &ncandidatevars; vname = cats("_", i); if vname not in (%MultiTransposeDQList(&by &pivot)) then do; if not found then output; found = 1; end; end; run; proc sql noprint; select strip(vname) into :tmpvar from &dsCandidateVarnames; quit; %let dsRowvarsFreq = %MultiTransposeNewDatasetName(rowvarsfreq); proc sql; create table &dsRowvarsFreq as select %MultiTransposeCommasep(&by &pivot), sum(1) as &tmpvar from &data %if &dropMissingPivot eq 1 %then %do; where not missing(&pivot) %end; group %MultiTransposeCommasep(&by &pivot) ; quit; proc sql noprint; select max(&tmpvar) into :tmp from &dsRowvarsFreq; quit; proc datasets nolist; delete &dsCandidateVarnames &dsRowvarsFreq; quit; %if &tmp gt 1 %then %do; %put ERROR: [MultiTranspose] duplicates were found in data &data in variables (&by) * &pivot; %goto Farewell; %end; * ~~~ Now make sure that no duplicate (in by * copy) is found in source data set ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~; %let ncopy = %MultiTransposeNTokens(©); %if &ncopy %then %do; %let dsCopiedVars = %MultiTransposeNewDatasetName(copiedvars); proc sql; create table &dsCopiedVars as select distinct %MultiTransposeCommasep(&by ©) from &data; quit; proc sql; create table &dsRowvarsFreq as select %MultiTransposeCommasep(&by), sum(1) as &tmpvar from &dsCopiedVars group %MultiTransposeCommasep(&by); quit; proc sql noprint; select max(&tmpvar) into :tmp from &dsRowvarsFreq; quit; proc datasets nolist; delete &dsRowvarsFreq; quit; %if &tmp gt 1 %then %do; proc datasets nolist; delete &dsCopiedVars; quit; %put ERROR: [MultiTranspose] some copy variables (©) are not uniquely defined for some output data rows (defined by &by); %goto Farewell; %end; %end; * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~; * Create &out, just to make sure it exists and its name is not recycled; data &out; stop; run; %let dsContents = %MultiTransposeNewDatasetName(contents); proc contents data=&data noprint out=&dsContents (keep=name label type format formatl); run; %let dsTmp = %MultiTransposeNewDatasetName(tmp); proc sql noprint; select compress(ifc(substr(format,1,1) eq "$", substr(format,2), format)), type eq 1, formatl, format in ("DATE", "DDMMYY", "DDMMYYB", "DDMMYYC", "DDMMYYD", "DDMMYYN", "DDMMYYP", "DDMMYYS", "EURDFDE", "EURDFMY", "EURDFDMY", "EURDFWKX", "JULIAN", "MINGUO", "MMDDYY", "MMDDYYB", "MMDDYYC", "MMDDYYD", "MMDDYYN", "MMDDYYP", "MMDDYYS", "MMYY", "MMYYC", "MMYYD", "MMYYN", "MMYYP", "MMYYS", "MONYY", "NENGO", "PDJULG", "PDJULI", "WEEKDATE", "WORDDATE", "WORDDATX", "YYMM", "YYMMC", "YYMMDD", "YYMMP", "YYMMS", "YYMMN", "YYMMDD", "YYMON", "YYQ", "YYQC", "YYQD", "YYQP", "YYQSYYQN", "YYQR", "YYQRC", "YYQRD", "YYQRP", "YYQRS") into :pivotfmt, :pivotIsNumeric, :formatl, :pivotIsDate from &dsContents where upcase(name) eq upcase("&pivot"); quit; %if &pivotIsDate %then %do; %if &formatl eq 0 %then %let datefmt=&pivotfmt; %else %let datefmt=%sysfunc(compress(&pivotfmt.&formatl)); %end; /* Pivot values */; %let dsPivotObsValues = %MultiTransposeNewDatasetName(obspivots); proc sql; create table &dsPivotObsValues as select distinct(&pivot) as PivotValue from &data %if &dropMissingPivot %then %do; where not missing(&pivot) %end; order &pivot; quit; data &dsPivotObsValues; set &dsPivotObsValues; PivotIndex = _N_; run; proc sql noprint; select N(PivotIndex) into :npivotvalues from &dsPivotObsValues; quit; /* Vars to transpose */; %let nvars = %MultiTransposeNTokens(&vars); %let dsTransposedVars = %MultiTransposeNewDatasetName(transposedvars); data &dsTransposedVars; length name $32; %do v = 1 %to &nvars; %let var = %scan(&vars, &v); name = "&var"; output; %end; run; %let dsNewVars = %MultiTransposeNewDatasetName(newvars); %if &pivotIsNumeric %then %do; proc sql; create table &dsNewVars as select v.name, upcase(v.name) as ucname, s.PivotValue, s.PivotIndex, case when s.PivotValue eq . then cats(v.name, "00") %if &pivotIsDate %then %do; else cats(v.name, compress(put(s.PivotValue, &datefmt..))) %end; %else %do; else cats(v.name, s.PivotValue) %end; end as NewVar length=200 from &dsTransposedVars as v, &dsPivotObsValues as s; quit; %end; %else %do; %if &UseNumericExt %then %do; proc sql; create table &dsNewVars as select v.name, upcase(v.name) as ucname, s.PivotValue, s.PivotIndex, cats(v.name, s.PivotIndex) as NewVar length=200 from &dsTransposedVars as v, &dsPivotObsValues as s; quit; %end; %else %do; proc sql; create table &dsNewVars as select v.name, upcase(v.name) as ucname, s.PivotValue, s.PivotIndex, tranwrd(compbl(cats(v.name, s.PivotValue)), " ", "_") as NewVar length=200 from &dsTransposedVars as v, &dsPivotObsValues as s; quit; %end; %end; data &dsNewVars (drop=j); set &dsNewVars; j = notalnum(NewVar); do while(j gt 0 and j le length(NewVar)); if j gt 1 then NewVar = substr(NewVar, 1, j-1) || "_" || substr(NewVar, j+1); else if j eq 1 then NewVar = "_" || substr(NewVar, 2); j = notalnum(NewVar, j+1); end; ucnewvar = upcase(NewVar); run; %let dsXtraVars = %MultiTransposeNewDatasetName(xtravars); data &dsXtraVars; length ucnewvar $ 200; %do i = 1 %to &nbyvars; %let xtravar = %scan(&by, &i); ucnewvar = strip(upcase("&xtravar")); output; %end; %do i = 1 %to &ncopy; %let xtravar = %scan(©, &i); ucnewvar = strip(upcase("&xtravar")); output; %end; run; %let dsNewVarsFreq = %MultiTransposeNewDatasetName(newvarsfreq); proc sql; create table &dsNewVarsFreq as select a.ucnewvar, N(a.ucnewvar) as f from ( select ucnewvar from &dsNewVars outer union corresponding select ucnewvar from &dsXtraVars ) as a group a.ucnewvar; quit; proc datasets nolist; delete &dsXtraVars; quit; proc sql noprint; select ucnewvar, N(ucnewvar) gt 0 into :multipdefnvars separated by ", ", :anyrepeatedvarname from &dsNewVarsFreq where f gt 1; quit; %if &anyrepeatedvarname %then %do; %put ERROR: [MultiTranspose] given the variables to transpose and the values taken by variable &pivot, some variables created in transposed output data set (&multipdefnvars) would have ambiguous meanings: please rename some of the variables to transpose prior to calling MultiTranspose again in order to avoid these ambiguities.; proc datasets nolist; delete &out; quit; %goto ByeBye; %end; /* Pivot fmt values */; %let dsPivotLabels = %MultiTransposeNewDatasetName(pivotlabels); %let formattedPivot = 0; %if %length(&pivotfmt) %then %do; %if &pivotIsDate %then %do; %let formattedPivot = 1; %let anyfmtHigh = 0; %let anyfmtLow = 0; %let anyfmtOther = 0; proc sql; create table &dsPivotLabels as select PivotValue as start, PivotValue as end, compress(put(PivotValue, &datefmt..)) as Label from &dsPivotObsValues; quit; %end; %else %if %upcase("&library") eq "WORK" or %sysfunc(exist(&library..formats)) %then %do; %let formattedPivot = 1; proc format library=&library cntlout=&dsTmp; run; data &dsTmp; set &dsTmp; if upcase(fmtname) ne upcase("&pivotfmt") then delete; High = 0; Low = 0; Other = 0; if upcase(HLO) eq "L" then do; start = ""; Low = 1; end; else if upcase(HLO) eq "H" then do; end = ""; High = 1; end; else if upcase(HLO) eq "O" then do; start = ""; end = ""; Other = 1; end; run; %if &pivotIsNumeric %then %do; proc sql; create table &dsPivotLabels as select input(start, best32.) as start, input(end, best32.) as end, Label, High, Low, Other from &dsTmp; quit; %end; %else %do; proc sql; create table &dsPivotLabels as select start, end, Label, High, Low, Other from &dsTmp; quit; %end; proc sql noprint; select max(High), max(Low), max(Other) into :anyfmtHigh, :anyfmtLow, :anyfmtOther from &dsPivotLabels; quit; %if &anyfmtHigh %then %do; %let dsPivotLabelsHigh = %MultiTransposeNewDatasetName(pivotlabelshigh); proc sql; create table &dsPivotLabelsHigh as select start, Label from &dsPivotLabels where High eq 1; delete from &dsPivotLabels where High eq 1; quit; %end; %if &anyfmtLow %then %do; %let dsPivotLabelsLow = %MultiTransposeNewDatasetName(pivotlabelslow); proc sql; create table &dsPivotLabelsLow as select end, Label from &dsPivotLabels where Low eq 1; delete from &dsPivotLabels where Low eq 1; quit; %end; %if &anyfmtOther %then %do; %let dsPivotLabelsOther = %MultiTransposeNewDatasetName(pivotlabelsother); proc sql; create table &dsPivotLabelsOther as select Label from &dsPivotLabels where Other eq 1; delete from &dsPivotLabels where Other eq 1; quit; %end; proc datasets nolist; delete &dsTmp; quit; %end; %end; %else %do; proc sql; create table &dsPivotLabels as select PivotValue as start, PivotValue as end, "" as Label from &dsPivotObsValues; quit; %end; /* Transpose data, one pivot-value at a time */; %let dsLocalOut = %MultiTransposeNewDatasetName(localout); %let dsTmpOut = %MultiTransposeNewDatasetName(tmpout); %do s = 1 %to &npivotvalues; proc sql noprint; select name, NewVar, NewVar into :vars separated by ' ', :newvars separated by ' ', :ynewvars separated by ", y." from &dsNewVars where PivotIndex eq &s; quit; proc sql; create table &dsTmp as select %MultiTransposeCommasep4sql(d, &by) %do v = 1 %to &nvars; %let var = %scan(&vars, &v); %let newvar = %scan(&newvars, &v); , d.&var as &newvar %end; from &data as d, &dsPivotObsValues as s where d.&pivot eq s.PivotValue and s.PivotIndex eq &s; quit; %if &s eq 1 %then %do; proc datasets nolist; change &dsTmp=&dsLocalOut; quit; %let xnewvars=&newvars; %end; %else %do; proc sql; create table &dsTmpOut as select %do i = 1 %to &nbyvars; %let byvar = %scan(&by, &i); coalesce(x.&byvar, y.&byvar) as &byvar, %end; %MultiTransposeCommasep4sql(x, &xnewvars), y.&ynewvars from &dsLocalOut as x full join &dsTmp as y on %do i = 1 %to &nbyvars; %let byvar = %scan(&by, &i); %if &i gt 1 %then %do; and %end; x.&byvar eq y.&byvar %end; ; quit; proc datasets nolist; delete &dsLocalOut; change &dsTmpOut=&dsLocalOut; quit; %let xnewvars=&xnewvars &newvars; %end; %end; %if &ncopy eq 0 %then %do; proc datasets nolist; delete &out; change &dsLocalOut=&out; quit; %end; %else %do; proc sql; create table &out as select t.*, %MultiTransposeCommasep4sql(c, ©) from &dsLocalOut as t, &dsCopiedVars as c where %do i = 1 %to &nbyvars; %let byvar = %scan(&by, &i); %if &i gt 1 %then %do; and %end; t.&byvar eq c.&byvar %end; ; quit; proc datasets nolist; delete &dsCopiedVars &dsLocalOut; quit; %end; /* Get variable labels */; proc sql; create table &dsTmp as select t.*, c.label from &dsTransposedVars as t, &dsContents as c where upcase(t.name) eq upcase(c.name); quit; proc sql noprint; select max(length(strip(label))), max(length(strip(name))), max(missing(label)) into :llabel, :lmax, :anymissinglabel from &dsTmp; quit; %if &anymissinglabel and &lmax gt &llabel %then %let llabel = &lmax; proc sql; create table &dsTransposedVars as select *, coalesce(strip(label), strip(name)) as newvarLabel from &dsTmp; quit; proc datasets nolist; delete &dsTmp; quit; * If pivot is a formatted variable, get the formats for each of its values, else define a label as "pivot = Value"; %if &formattedPivot %then %do; proc sql; create table &dsTmp as select s.PivotValue, s.PivotIndex, l.Label as PivotLabel from &dsPivotObsValues as s left join &dsPivotLabels as l on (missing(s.PivotValue) and s.PivotValue eq l.start) or (not missing(s.PivotValue) and s.PivotValue ge l.start and s.PivotValue le l.end); quit; %if &anyfmtHigh %then %do; proc datasets nolist; delete &dsPivotObsValues; change &dsTmp=&dsPivotObsValues; quit; proc sql; create table &dsTmp as select s.PivotValue, s.PivotIndex, coalesce(s.Label, x.Label) as PivotLabel from &dsPivotObsValues as s left join &dsPivotLabelsHigh as x on s.PivotValue ge x.start; quit; proc datasets nolist; delete &dsPivotLabelsHigh; quit; %end; %if &anyfmtLow %then %do; proc datasets nolist; delete &dsPivotObsValues; change &dsTmp=&dsPivotObsValues; quit; proc sql; create table &dsTmp as select s.PivotValue, s.PivotIndex, coalesce(s.Label, x.Label) as PivotLabel from &dsPivotObsValues as s left join &dsPivotLabelsLow as x on s.PivotValue le x.end; quit; proc datasets nolist; delete &dsPivotLabelsLow; quit; %end; %if &anyfmtOther %then %do; proc datasets nolist; delete &dsPivotObsValues; change &dsTmp=&dsPivotObsValues; quit; proc sql; create table &dsTmp as select s.PivotValue, s.PivotIndex, coalesce(s.Label, x.Label) as PivotLabel from &dsPivotObsValues as s, &dsPivotLabelsOther as x; quit; proc datasets nolist; delete &dsPivotLabelsOther; quit; %end; %end; %else %do; proc sql; create table &dsTmp as select PivotValue, PivotIndex, "" as PivotLabel from &dsPivotObsValues; quit; %end; proc datasets nolist; delete &dsPivotObsValues; change &dsTmp=&dsPivotObsValues; quit; proc sql noprint; select N(PivotIndex) gt 0 into :anymissingpivotlabel from &dsPivotObsValues where missing(PivotLabel); quit; %if &anymissingpivotlabel %then %do; proc sql noprint; select max(length(PivotLabel)) into :lpivotlabel from &dsPivotObsValues; quit; %if &pivotIsNumeric %then %do; proc sql noprint; select max(length(strip(put(PivotValue, best32.)))) into :lpivotmylabel from &dsPivotObsValues; quit; %end; %else %do; proc sql noprint; select max(length(PivotValue)) into :lpivotmylabel from &dsPivotObsValues; quit; %end; %let lpivotmylabel = %sysevalf(3+&lpivotmylabel+%length(&pivot)); %if &lpivotmylabel gt &lpivotlabel %then %let lpivotlabel = &lpivotmylabel; %if &pivotIsNumeric %then %do; proc sql; create table &dsTmp as select PivotValue, PivotIndex, coalesce(PivotLabel, catx(" = ", strip("&pivot"), strip(put(PivotValue, best32.)))) as PivotLabel length=&lpivotlabel from &dsPivotObsValues; quit; %end; %else %do; proc sql; create table &dsTmp as select PivotValue, PivotIndex, coalesce(PivotLabel, catx(" = ", strip("&pivot"), strip(PivotValue))) as PivotLabel length=&lpivotlabel from &dsPivotObsValues; quit; %end; proc datasets nolist; delete &dsPivotObsValues; change &dsTmp=&dsPivotObsValues; quit; %end; * Give new labels to new (transposed) variables; proc sql; create table &dsTmp as select n.newvar, t.newvarlabel, s.PivotLabel from &dsNewVars as n, &dsTransposedVars as t, &dsPivotObsValues as s where n.name eq t.name and n.PivotIndex eq s.PivotIndex; quit; proc datasets nolist; delete &dsNewVars; change &dsTmp=&dsNewVars; quit; proc sql noprint; select NewVar, N(NewVar) into :newvars separated by ' ', :nNewvars from &dsNewVars; quit; %do i = 1 %to &nNewvars; %let newvar = %scan(&newvars, &i); proc sql noprint; select catx(":: ", tranwrd(newvarLabel, '"', '""'), tranwrd(PivotLabel, '"', '""')) into :newlbl from &dsNewVars where NewVar eq "&newvar"; quit; proc datasets nolist; modify &out; label &newvar = "&newlbl"; quit; %end; * Put back format on by variables; %do i = 1 %to &nbyvars; %let byvar = %scan(&by, &i); %let byfmt=; %let bylbl=; proc sql noprint; select ifc(anyalnum(format) or formatl gt 0, cats(format, ifc(formatl gt 0, strip(put(formatl, 4.)), ""), "."), ""), tranwrd(label, '"', '""') into :byfmt, :bylbl from &dsContents where lowcase(name) eq lowcase("&byvar"); quit; %if %length(&byfmt) or %length(&bylbl) %then %do; proc datasets nolist; modify &out; %if %length(&bylbl) %then %do; label &byvar = "&bylbl"; %end; %if %length(&byfmt) %then %do; format &byvar &byfmt; %end; quit; %end; %end; proc datasets nolist; delete &dsPivotLabels; quit; %ByeBye: proc datasets nolist; delete &dsContents &dsNewVars &dsNewVarsFreq &dsPivotObsValues &dsTransposedVars; quit; %Farewell: %mend; %macro MultiTransposeCommasep(lov); %sysfunc(tranwrd(%Qsysfunc(compbl(%sysfunc(strip(&lov)))), %str( ), %str(, ))) %mend; %macro MultiTransposeCommasep4sql(datasetindex, lov); &datasetindex..%sysfunc(tranwrd(%Qsysfunc(compbl(%sysfunc(strip(&lov)))), %str( ), %str(, &datasetindex..))) %mend; %macro MultiTransposeDQList(list); "%sysfunc(tranwrd(%sysfunc(compbl(&list)),%quote( ),%quote(", ")))" %mend; %macro MultiTransposeNewDatasetName(proposalname); %*Finds the first unused dataset named *datasetname*, adding a leading underscore and a numeric suffix as large as necessary to make it unique!; %local i newdatasetname; %let proposalname=%sysfunc(compress(&proposalname)); %let newdatasetname=_&proposalname; %do %while(%sysfunc(exist(&newdatasetname))); %let i = %eval(&i+1); %let newdatasetname=_&proposalname&i; %end; &newdatasetname %mend; %macro MultiTransposeNTokens(list); %if %length(&list) %then %do; %eval(1 + %length(%sysfunc(compbl(&list))) - %length(%sysfunc(compress(&list)))) %end; %else %do; 0 %end; %mend; %MultiTranspose(out=widescores, data=scores, vars=Raw Theta Computed Uncorr AgeCorr FullT, by=pin Assessment_Name, pivot=Short, copy=, dropMissingPivot=1, UseNumericExt=0, library=work); data widescores; set widescores; drop ThetaDCCS ComputedDCCS UncorrDCCS AgeCorrDCCS FullTDCCS ThetaFlanker ComputedFlanker UncorrFlanker AgeCorrFlanker FullTFlanker RawEngRead RawEngVocab ThetaListSort ComputedListSort UncorrPSM AgeCorrPSM FullTPSM ThetaPatternComp ComputedPatternComp UncorrPatternComp AgeCorrPatternComp FullTPatternComp; run; ** Import and process raw data (for DCCS and Flanker) **; proc import file="&path/&assessment..csv" out=asst dbms=csv replace; guessingrows=10000; run; proc sort data=asst; by PIN Assessment_Name Inst Position; run; data dccs; set asst; length AgeGroup $5.; if find(Inst, '(experimental)', 'i')>0 then delete; if find(Inst, 'Dimensional', 'i')=0 then delete; if find(ItemID, '_PRAC', 'i')>0 or find(ItemID, '_INSTR', 'i')>0 or find(ItemID, '_INTRO', 'i')>0 or find(ItemID, '_NOWTRY', 'i')>0 or find(ItemID, '_NOWREADY', 'i')>0 then delete; if find(Inst, 'Ages 3-7', 'i')>0 then AgeGroup="3-7"; if find(Inst, 'Ages 8-11', 'i')>0 then AgeGroup="8-11"; if find(Inst, 'Age 12+', 'i')>0 then AgeGroup="12+"; keep PIN Assessment_Name AgeGroup ItemID Response Score Position ResponseTime; run; proc means data=dccs noprint nway sum; by PIN Assessment_Name; var score; id AgeGroup; output out=dccsAcc sum=RawDCCS; run; data DCCStimes; set DCCS; where Score=1 and find(ItemID,'_SWITCH','i')>0 and ResponseTime ge 0.1 and ResponseTime le 10; run; proc means data=DCCStimes noprint nway mean std; by PIN Assessment_Name; var ResponseTime; output out=dccsMean mean=MeanRT std=SDRT; run; data DCCStimes; merge DCCStimes dccsMean; by PIN Assessment_Name; if SDRT ne . then do; if ResponseTime < MeanRT-3*SDRT then delete; if ResponseTime > MeanRT+3*SDRT then delete; end; run; proc means data=DCCStimes noprint nway median; by PIN Assessment_Name; var ResponseTime; output out=dccsRT median=DCCSrt; run; data DCCSscore; merge dccsAcc dccsRT; by PIN Assessment_Name; drop _TYPE_ _FREQ_; if DCCSrt > 3 then DCCSrt=3; if AgeGroup="3-7" then DCCSaccuracy=RawDCCS*0.125; if AgeGroup in ("8-11", "12+") then DCCSaccuracy=(RawDCCS+10)*0.125; if AgeGroup in ("3-7", "8-11") and DCCSaccuracy > 4 and DCCSrt ne . then DCCSreactiontime = (5 - (5*((log10(DCCSrt)+0.1763598-log10(0.5))/(log10(3)-log10(0.5))))); if AgeGroup="12+" and DCCSaccuracy > 4 and DCCSrt ne . then DCCSreactiontime = (5 - (5*((log10(DCCSrt)+0.1186908-log10(0.5))/(log10(3)-log10(0.5))))); if . < DCCSreactiontime < 0 then DCCSreactiontime=0; if DCCSreactiontime > 5 then DCCSreactiontime=5; DCCSreactiontime=round(DCCSreactiontime, 0.001); ComputedDCCS=round(sum(of DCCSaccuracy DCCSreactiontime), 0.01); run; data flanker; set asst; length AgeGroup $5.; if find(Inst, '(experimental)', 'i')>0 then delete; if find(Inst, 'Flanker', 'i')=0 then delete; if find(ItemID, '_PRAC', 'i')>0 or find(ItemID, '_INSTR', 'i')>0 or find(ItemID, '_INTRO', 'i')>0 or find(ItemID, '_NOWTRY', 'i')>0 or find(ItemID, '_NOWREADY', 'i')>0 then delete; if find(Inst, 'Ages 3-7', 'i')>0 then AgeGroup="3-7"; if find(Inst, 'Ages 8-11', 'i')>0 then AgeGroup="8-11"; if find(Inst, 'Age 12+', 'i')>0 then AgeGroup="12+"; keep PIN Assessment_Name AgeGroup ItemID Response Score Position ResponseTime; run; proc means data=flanker noprint nway sum; by PIN Assessment_Name; var score; id AgeGroup; output out=flankerAcc sum=RawFlanker; run; data Flankertimes; set Flanker; where Score=1 and find(ItemID,'ARROW_INCONGRUENT','i')>0 and ResponseTime ge 0.1 and ResponseTime le 10; run; proc means data=Flankertimes noprint nway mean std; by PIN Assessment_Name; var ResponseTime; output out=FlankerMean mean=MeanRT std=SDRT; run; data Flankertimes; merge Flankertimes FlankerMean; by PIN Assessment_Name; if SDRT ne . then do; if ResponseTime < MeanRT-3*SDRT then delete; if ResponseTime > MeanRT+3*SDRT then delete; end; run; proc means data=Flankertimes noprint nway median; by PIN Assessment_Name; var ResponseTime; output out=FlankerRT median=FlankerRT; run; data Flankerscore; merge FlankerAcc FlankerRT; by PIN Assessment_Name; drop _TYPE_ _FREQ_; if FlankerRT > 3 then FlankerRT=3; if AgeGroup="3-7" then FlankerAccuracy=RawFlanker*0.125; if AgeGroup in ("8-11", "12+") then FlankerAccuracy=(RawFlanker+20)*0.125; if FlankerAccuracy > 4 and FlankerRT ne . then FlankerReactionTime = 5 - (5*((log10(FlankerRT)+0.1042566-log10(0.5))/(log10(3)-log10(0.5)))); if . < FlankerReactionTime < 0 then FlankerReactionTime=0; if FlankerReactionTime > 5 then FlankerReactionTime=5; FlankerReactionTime=round(FlankerReactionTime, 0.001); ComputedFlanker=round(sum(of FlankerAccuracy FlankerReactionTime), 0.01); run; ** Merge together, rescore PSM and Pattern Comparison, calculate norms and composites; data combined; merge widescores DCCSscore Flankerscore; by PIN Assessment_Name; run; data combined; merge combined reg; by PIN; run; proc format; invalue DCCSAd 0-1.55=0 1.56-2.07=1 2.08-2.18=2 2.19-2.43=3 2.44-3.78=4 3.79-5.96=5 5.97-6.68=6 6.69-7.20=7 7.21-7.59=8 7.60-7.90=9 7.91-8.18=10 8.19-8.51=11 8.52-8.76=12 8.77-9.03=13 9.04-9.31=14 9.32-9.65=15 9.66-9.87=16 9.88-9.99=17 10=18; invalue FlankAd 0-1.92=0 1.93-4.18=1 4.19-4.45=2 4.46-5.11=3 5.12-6.24=4 6.25-6.93=5 6.94-7.51=6 7.52-7.90=7 7.91-8.20=8 8.21-8.45=9 8.46-8.75=10 8.76-8.96=11 8.97-9.19=12 9.20-9.40=13 9.41-9.58=14 9.59-9.72=15 9.73-9.87=16 9.88-9.99=17 10=18; invalue ListAd 0-2=0 3-4=1 5=2 6-7=3 8-9=4 10-11=5 12=6 13-14=7 15=8 16=9 17=10 18=11 19=12 20=13 21=14 22=15 23-24=16 25=17 26=18; invalue PSMAd 200-217.60=0 217.61-257.35=1 257.36-293.24=2 293.25-303.79=3 303.80-333.22=4 333.23-352.61=5 352.62-382.38=6 382.39-415.59=7 415.60-442.62=8 442.63-481.43=9 481.44-521.53=10 521.54-552.56=11 552.57-599.04=12 599.05-625.89=13 625.90-653.76=14 653.77-677.94=15 677.95-689.94=16 689.95-700.89=17 700.90-722.27=18 722.28-778.57=19 778.58-800=20; invalue PCAd 0-16=0 17-24=1 25-27=2 28-29=3 30-33=4 34-38=5 39-42=6 43-46=7 47-49=8 50-53=9 54-57=10 58-61=11 62-64=12 65-68=13 69-72=14 73-75=15 76-78=16 79-81=17 82-84=18 85-97=19 98-130=20; invalue ReadAd -30 - -12.19=0 -12.18 - -4.75=1 -4.74 - -3.69=2 -3.68 - -1.97=3 -1.96 - -1.05=4 -1.04 - -0.01=5 0 - 1.07=6 1.08-2.14=7 2.15-3.03=8 3.04-3.96=9 3.97-4.84=10 4.85-5.73=11 5.74-6.81=12 6.82-7.56=13 7.57-8.23=14 8.24-8.84=15 8.85-9.16=16 9.17-9.35=17 9.36-9.97=18 9.98-16.36=19 16.37-20=20; invalue VocabAd -15 - -10.25=0 -10.24 - -4.78=1 -4.77 - -2.94=2 -2.93 - -0.84=3 -0.83 - 0.46=4 0.47 - 1.39=5 1.40 - 2.18=6 2.19-3.00=7 3.01-3.74=8 3.75-4.42=9 4.43-4.95=10 4.96-5.57=11 5.58-6.25=12 6.26-7.15=13 7.16-7.95=14 7.96-8.77=15 8.78-9.57=16 9.58-9.92=17 9.93-10.62=18 10.63-12.73=19 12.74-15=20; invalue DCCSCh 0-0.09=1 0.10-0.24=2 0.25-0.40=3 0.41-0.76=4 0.77-1.21=5 1.22-3.98=6 3.99-6.07=7 6.08-6.85=8 6.86-7.37=9 7.38-7.81=10 7.82-8.19=11 8.20-8.53=12 8.54-8.85=13 8.86-9.22=14 9.23-9.56=15 9.57-9.79=16 9.80-9.88=17 9.89-9.99=18 10=19; invalue FlankCh 0-0.11=0 0.12-0.58=1 0.59-0.88=2 0.89-1.26=3 1.27-1.64=4 1.65-2.16=5 2.17-5.12=6 5.13-6.79=7 6.80-7.56=8 7.57-8.08=9 8.09-8.51=10 8.52-8.88=11 8.89-9.15=12 9.16-9.37=13 9.38-9.55=14 9.56-9.73=15 9.74-9.86=16 9.87-9.99=17 10=18; invalue ListCh 0=1 1=2 2-3=3 4-5=4 6-7=5 8-9=6 10-12=7 13-14=8 15=9 16=10 17-18=11 19=12 20=13 21=14 22=15 23=16 24=17 25=18 26=19; invalue PSMCh 200-213.79=0 213.80-238.98=1 238.99-246.40=2 246.41-273.92=3 273.93-301.72=4 301.73-345.77=5 345.78-381.96=6 381.97-418.98=7 418.99-459.93=8 459.94-492.65=9 492.66-530.76=10 530.77-567.13=11 567.14-594.75=12 594.76-618.73=13 618.74-647.45=14 647.46-676.47=15 676.48-682.94=16 682.95-697.90=17 697.91-709.23=18 709.24-751.96=19 751.97-794.69=20 794.70-800=21; invalue PCCh 0-15=0 16-18=1 19=2 20-23=3 24-27=4 28-32=5 33-36=6 37-40=7 41-45=8 46-50=9 51-54=10 55-58=11 59-62=12 63-66=13 67-70=14 71-73=15 74-76=16 77-80=17 81-83=18 84-86=19 87-112=20 113-130=21; invalue ReadCh -30 - -23.20=0 -23.19 - -23.10=1 -23.09 - -22.45=2 -22.44 - -20.82=3 -20.81 - -19.47=4 -19.46 - -16.98=5 -16.97 - -10.41=6 -10.40 - -4.05=7 -4.04 - -1.87=8 -1.86 - -0.48=9 -0.47 - 0.63=10 0.64-1.72=11 1.73-2.64=12 2.65-3.53=13 3.54-4.56=14 4.57-5.68=15 5.69-6.77=16 6.78-8.02=17 8.03-8.61=18 8.62-9.16=19 9.17-15.31=20 15.32-20=21; invalue VocabCh -15 - -9.68=0 -9.67 - -8.75=1 -8.74 - -8.17=2 -8.16 - -7.15=3 -7.14 - -6.00=4 -5.99 - -4.88=5 -4.87 - -3.75=6 -3.74 - -2.59=7 -2.58 - -1.31=8 -1.30 - -0.08=9 -0.07 - 1.01=10 1.02-1.97=11 1.98-2.87=12 2.88-3.67=13 3.68-4.65=14 4.66-5.30=15 5.31-5.90=16 5.91-6.29=17 6.30-7.16=18 7.17-8.14=19 8.15-14.36=20 14.37-15=21; invalue DCCSWAd 0-0.54=0 0.55-2.06=1 2.07-2.20=2 2.21-2.91=3 2.92-3.81=4 3.82-5.82=5 5.83-6.60=6 6.61-7.10=7 7.11-7.53=8 7.54-7.88=9 7.89-8.15=10 8.16-8.50=11 8.51-8.77=12 8.78-9.03=13 9.04-9.30=14 9.31-9.69=15 9.70-9.87=16 9.88-9.99=17 10=18; invalue FlankWAd 0-0.68=0 0.69-4.06=1 4.07-4.36=2 4.37-4.95=3 4.96-6.17=4 6.18-6.75=5 6.76-7.42=6 7.43-7.83=7 7.84-8.16=8 8.17-8.45=9 8.46-8.73=10 8.74-8.95=11 8.96-9.18=12 9.19-9.40=13 9.41-9.58=14 9.59-9.73=15 9.74-9.87=16 9.88-9.99=17 10=18; invalue ListWAd 0-1=0 2-3=1 4-5=2 6-7=3 8-9=4 10-11=5 12-13=6 14=7 15=8 16=9 17=10 18=11 19=12 20=13 21=14 22=15 23-24=16 25=17 26=18; invalue PSMWAd 200-203.32=0 203.33-244.53=1 244.54-289.78=2 289.79-300.46=3 300.47-331.71=4 331.72-352.26=5 352.27-382.36=6 382.37-417.12=7 417.13-442.95=8 442.96-480.65=9 480.66-522.65=10 522.66-550.57=11 550.58-596.90=12 596.91-624.29=13 624.30-653.19=14 653.20-677.92=15 677.93-690.73=16 690.74-700.91=17 700.92-722.91=18 722.92-794.52=19 794.53-800=20; invalue PCWAd 0-5=0 6-25=1 26-27=2 28=3 29-32=4 33-38=5 39-42=6 43-46=7 47-49=8 50-53=9 54-56=10 57-60=11 61-65=12 66-68=13 69-72=14 73-75=15 76-78=16 79-81=17 82-87=18 88-124=19 125-130=20; invalue ReadWAd -30 - -24.08=0 -24.07 - -5.18=1 -5.17 - -3.43=2 -3.42 - -1.06=3 -1.05 - -0.13=4 -0.12 - 0.70=5 0.71 - 1.58=6 1.59-2.58=7 2.59-3.39=8 3.40-4.27=9 4.28-5.12=10 5.13-6.03=11 6.04-6.91=12 6.92-7.71=13 7.72-8.38=14 8.39-8.94=15 8.95-9.21=16 9.22-9.63=17 9.64-11.04=18 11.05-18.78=19 18.79-20=20; invalue VocabWAd -15 - -14.66=0 -14.65 - -4.72=1 -4.71 - -3.20=2 -3.19 - -1.15=3 -1.14 - 0.53=4 0.54 - 1.87=5 1.88 - 2.77=6 2.78-3.61=7 3.62-4.16=8 4.17-4.73=9 4.74-5.26=10 5.27-5.90=11 5.91-6.60=12 6.61-7.37=13 7.38-8.09=14 8.10-8.88=15 8.89-9.62=16 9.63-10.37=17 10.38-10.75=18 10.76-14.85=19 14.86-15=20; invalue DCCSAAd 0-2.14=2 2.15-2.51=3 2.52-5.10=4 5.11-6.60=5 6.61-7.07=6 7.08-7.36=7 7.37-7.63=8 7.64-7.91=9 7.92-8.17=10 8.18-8.39=11 8.40-8.56=12 8.57-8.80=13 8.81-9.24=14 9.25-9.52=15 9.53-9.73=16 9.74-9.85=17 9.86-10=18; invalue FlankAAd 0-4.59=2 4.60-5.47=3 5.48-6.01=4 6.02-6.73=5 6.74-7.36=6 7.37-7.85=7 7.86-8.07=8 8.08-8.31=9 8.32-8.53=10 8.54-8.77=11 8.78-8.98=12 8.99-9.30=13 9.31-9.44=14 9.45-9.65=15 9.66-9.77=16 9.78-9.98=17 9.99-10=18; invalue ListAAd 0-6=2 7-8=3 9-10=4 11=5 12-13=6 14=8 15=9 16=10 17-18=11 19=12 20=14 21-22=15 23=16 24=17 25-26=18; invalue PSMAAd 200-311.14=2 311.15-324.52=3 324.53-333.35=4 333.36-359.23=5 359.24-376.23=6 376.24-400.45=7 400.46-428.47=8 428.48-469.41=9 469.42-500.82=10 500.83-528.54=11 528.55-585.59=12 585.60-614.46=13 614.47-639.02=14 639.03-667.76=15 667.77-689.98=16 689.99-705.78=17 705.79-800=18 ; invalue PCAAd 0-24=2 25-30=3 31-33=4 34-37=5 38-40=6 41-43=7 44-47=8 48-52=9 53-55=10 56-58=11 59-61=12 62-65=13 66-69=14 70-73=15 74-76=16 77-83=17 84-130=18; invalue ReadAAd -30 - -10.91=2 -10.90 - -3.66=3 -3.65 - -1.97=4 -1.96 - -1.32=5 -1.31 - -0.57=6 -0.56 - 0.83=7 0.84-1.87=8 1.88-2.74=9 2.75-3.52=10 3.53-4.17=11 4.18-5.04=12 5.05-5.84=13 5.85-7.39=14 7.40-8.36=15 8.37-8.78=16 8.79-8.97=17 8.98-20=18; invalue VocabAAd -15 - -2.24=2 -2.23 - -0.45=3 -0.44 - 0.36=4 0.37 - 0.74=5 0.75 - 1.39=6 1.40-2.06=7 2.07-2.77=8 2.78-3.54=9 3.55-3.89=10 3.90-4.40=11 4.41-5.08=12 5.09-5.33=13 5.34-5.94=14 5.95-7.67=15 7.68-9.16=16 9.17-9.43=17 9.44-15=18; invalue DCCSHAd 0-0.87=2 0.88-2.15=3 2.16-2.28=4 2.29-4.73=5 4.74-6.70=6 6.71-7.43=7 7.44-7.74=8 7.75-8.05=9 8.06-8.32=10 8.33-8.67=11 8.68-8.86=12 8.87-9.27=13 9.28-9.46=14 9.47-9.66=15 9.67-9.89=16 9.90-10=17; invalue FlankHAd 0-3.44=2 3.45-5.69=3 5.70-6.75=4 6.76-7.64=5 7.65-8.04=6 8.05-8.24=7 8.25-8.33=8 8.34-8.74=9 8.75-8.98=10 8.99-9.16=11 9.17-9.37=12 9.38-9.48=13 9.49-9.64=14 9.65-9.76=15 9.77-9.99=16 10=17; invalue ListHAd 0-4=2 5-7=3 8-9=4 10=5 11-12=6 13-14=7 15=8 16=9 17=10 18=11 19=12 20=13 21-22=14 23=15 24=16 25=17 26=18; invalue PSMHAd 200-235.69=2 235.70-310.53=3 310.54-339.79=4 339.80-355.26=5 355.27-403.52=6 403.53-428.28=7 428.29-474.55=8 474.56-520.25=9 520.26-571.80=10 571.81-594.02=11 594.03-626.25=12 626.26-651.07=13 651.08-677.55=14 677.56-683.45=15 683.46-698.33=16 698.34-749.31=17 749.32-800=18; invalue PCHAd 0-16=2 17-32=3 33-39=4 40-44=5 45-47=6 48-49=7 50-52=8 53-57=9 58-60=10 61-63=11 64-65=12 66-69=13 70-72=14 73-74=15 75-80=16 81-102=17 103-130=18; invalue ReadHAd -30 - -12.15=2 -12.14 - -2.01=3 -2.00 - -1.15=4 -1.14 - 0.26=5 0.27 - 0.86=6 0.87-2.21=7 2.22-2.82=8 2.83-3.88=9 3.89-5.08=10 5.09-6.22=11 6.23-7.02=12 7.03-7.57=13 7.58-8.00=14 8.01-8.86=15 8.87-9.03=16 9.04-12.91=17 12.92-20=18; invalue VocabHAd -15 - -8.50=2 -8.49 - -1.76=3 -1.75 - 0.07=4 0.08 - 1.29=5 1.30 - 1.93=6 1.94-2.60=7 2.61-3.27=8 3.28-3.68=9 3.69-4.56=10 4.57-5.63=11 5.64-6.24=12 6.25-7.33=13 7.34-7.91=14 7.92-8.64=15 8.65-9.23=16 9.24-12.38=17 12.39-15=18; invalue DCCSWCh 0-0.02=0 0.03-0.10=1 0.11-0.25=2 0.26-0.45=3 0.46-0.82=4 0.83-2.12=5 2.13-4.68=6 4.69-6.24=7 6.25-6.98=8 6.99-7.50=9 7.51-7.92=10 7.93-8.28=11 8.29-8.63=12 8.64-8.97=13 8.98-9.34=14 9.35-9.62=15 9.63-9.86=16 9.87-9.90=17 9.91-10=18; invalue FlankWCh 0-0.23=0 0.24-0.62=1 0.63-0.93=2 0.94-1.30=3 1.31-1.70=4 1.71-2.24=5 2.25-5.54=6 5.55-7.01=7 7.02-7.69=8 7.70-8.18=9 8.19-8.59=10 8.60-8.92=11 8.93-9.17=12 9.18-9.40=13 9.41-9.57=14 9.58-9.75=15 9.76-9.87=16 9.88-9.99=17 10=18; invalue ListWCh 0=1 1=2 2-3=3 4-5=4 6-7=5 8-10=6 11-12=7 13-14=8 15-16=9 17=10 18=11 19=12 20=13 21=14 22=15 23-24=16 25=17 26=18; invalue PSMWCh 200-220.69=0 220.70-238.89=1 238.90-244.73=2 244.74-272.49=3 272.50-301.72=4 301.73-345.66=5 345.67-385.43=6 385.44-434.58=7 434.59-471.92=8 471.93-504.89=9 504.90-543.81=10 543.82-575.26=11 575.27-603.67=12 603.68-627.12=13 627.13-650.15=14 650.16-677.27=15 677.28-686.47=16 686.48-700.02=17 700.03-719.18=18 719.19-766.05=19 766.06-800=20; invalue PCWCh 0-15=0 16-18=1 19-20=2 21-23=3 24-28=4 29-32=5 33-36=6 37-41=7 42-46=8 47-51=9 52-55=10 56-59=11 60-63=12 64-67=13 68-70=14 71-74=15 75-77=16 78-81=17 82-84=18 85-89=19 90-130=20; invalue ReadWCh -30 - -23.94=0 -23.93 - -23.04=1 -23.03 - -21.72=2 -21.71 - -20.13=3 -20.12 - -18.83=4 -18.82 - -16.53=5 -16.52 - -9.64=6 -9.63 - -3.51=7 -3.50 - -1.30=8 -1.29 - -0.10=9 -0.09 - 1.03=10 1.04-2.08=11 2.09-3.00=12 3.01-3.83=13 3.84-4.94=14 4.95-6.03=15 6.04-6.96=16 6.97-8.14=17 8.15-8.63=18 8.64-9.23=19 9.24-20=20; invalue VocabWCh -15 - -8.39=0 -8.38 - -8.23=1 -8.22 - -7.77=2 -7.76 - -6.72=3 -6.71 - -5.61=4 -5.60 - -4.60=5 -4.59 - -3.30=6 -3.29 - -2.04=7 -2.03 - -0.74=8 -0.73 - 0.51=9 0.52 - 1.53=10 1.54-2.54=11 2.55-3.29=12 3.30-4.20=13 4.21-4.93=14 4.94-5.56=15 5.57-6.01=16 6.02-6.50=17 6.51-7.79=18 7.80-8.21=19 8.22-15=20; invalue DCCSACh 0-0.02=1 0.03-0.19=2 0.20-0.33=3 0.34-0.58=4 0.59-0.92=5 0.93-3.67=6 3.68-5.57=7 5.58-6.54=8 6.55-7.21=9 7.22-7.61=10 7.62-8.01=11 8.02-8.33=12 8.34-8.69=13 8.70-9.02=14 9.03-9.40=15 9.41-9.79=16 9.80-9.88=17 9.89-10=18; invalue FlankACh 0-0.54=1 0.55-0.76=2 0.77-1.21=3 1.22-1.67=4 1.68-2.62=5 2.63-5.02=6 5.03-6.40=7 6.41-7.20=8 7.21-7.86=9 7.87-8.36=10 8.37-8.74=11 8.75-9.09=12 9.10-9.31=13 9.32-9.42=14 9.43-9.59=15 9.60-9.83=16 9.84-9.93=17 9.94-9.99=18 10=19; invalue ListACh 0=2 1-3=3 4=4 5-6=5 7-9=6 10-11=7 12=8 13-14=9 15=10 16=11 17=12 18-19=13 20=14 21=15 22=16 23=17 24-25=18 26=19; invalue PSMACh 200-212.74=1 212.75-246.48=2 246.49-274.80=3 274.81-298.08=4 298.09-345.46=5 345.47-369.98=6 369.99-411.03=7 411.04-436.76=8 436.77-472.53=9 472.54-501.08=10 501.09-537.51=11 537.52-570.06=12 570.07-594.17=13 594.18-618.94=14 618.95-641.91=15 641.92-679.77=16 679.78-692.02=17 692.03-748.41=18 748.42-800=19; invalue PCACh 0-19=1 20=2 21-23=3 24-28=4 29-32=5 33-35=6 36-39=7 40-44=8 45-48=9 49-52=10 53-56=11 57-60=12 61-64=13 65-67=14 68-70=15 71-74=16 75-78=17 79-84=18 85-130=19; invalue ReadACh -30 - -25.67=1 -25.66 - -22.22=2 -22.21 - -21.22=3 -21.21 - -18.90=4 -18.89 - -16.02=5 -16.01 - -9.31=6 -9.30 - -4.29=7 -4.28 - -2.50=8 -2.49 - -1.20=9 -1.19 - -0.23=10 -0.22 - 0.91=11 0.92-1.83=12 1.84-2.55=13 2.56-3.55=14 3.56-4.60=15 4.61-6.18=16 6.19-7.61=17 7.62-8.89=18 8.90-20=19; invalue VocabACh -15 - -9.52=1 -9.51 - -8.06=2 -8.05 - -6.99=3 -6.98 - -5.84=4 -5.83 - -4.91=5 -4.90 - -4.26=6 -4.25 - -2.93=7 -2.92 - -1.80=8 -1.79 - -0.74=9 -0.73 - 0.03=10 0.04-0.90=11 0.91-1.80=12 1.81-2.67=13 2.68-3.39=14 3.40-4.31=15 4.32-5.10=16 5.11-6.10=17 6.11-7.16=18 7.17-15=19; invalue DCCSHCh 0-0.03=1 0.04-0.25=2 0.26-0.57=3 0.58-0.92=4 0.93-2.27=5 2.28-4.04=6 4.05-6.06=7 6.07-6.75=8 6.76-7.29=9 7.30-7.62=10 7.63-8.09=11 8.10-8.40=12 8.41-8.73=13 8.74-9.04=14 9.05-9.37=15 9.38-9.70=16 9.71-9.79=17 9.80-9.96=18 9.97-10=19; invalue FlankHCh 0-0.03=1 0.04-0.77=2 0.78-1.17=3 1.18-1.55=4 1.56-2.07=5 2.08-4.94=6 4.95-6.47=7 6.48-7.27=8 7.28-7.92=9 7.93-8.40=10 8.41-8.81=11 8.82-9.10=12 9.11-9.35=13 9.36-9.52=14 9.53-9.67=15 9.68-9.81=16 9.82-9.98=17 9.99-10=18; invalue ListHCh 0=2 1-3=3 4=4 5-7=5 8-9=6 10-11=7 12-13=8 14-15=9 16=10 17=11 18=12 19=13 20=14 21=15 22=16 23-24=17 25-26=18; invalue PSMHCh 200-246.43=1 246.44-265.64=2 265.65-280.96=3 280.97-319.17=4 319.18-349.51=5 349.52-383.37=6 383.38-416.43=7 416.44-456.10=8 456.11-495.43=9 495.44-528.70=10 528.71-558.42=11 558.43-588.69=12 588.70-614.27=13 614.28-645.28=14 645.29-670.54=15 670.55-683.22=16 683.23-702.22=17 702.23-754.11=18 754.12-800=19; invalue PCHCh 0-13=1 14-18=2 19-20=3 21-26=4 27-31=5 32-35=6 36-39=7 40-44=8 45-48=9 49-52=10 53-56=11 57-61=12 62-65=13 66-68=14 69-71=15 72-75=16 76-77=17 78-79=18 80-130=19; invalue ReadHCh -30 - -24.62=1 -24.61 - -23.10=2 -23.09 - -21.58=3 -21.57 - -19.84=4 -19.83 - -18.28=5 -18.27 - -11.90=6 -11.89 - -5.02=7 -5.01 - -2.31=8 -2.30 - -0.83=9 -0.82 - 0.32=10 0.33-1.26=11 1.27-2.24=12 2.25-3.26=13 3.27-3.92=14 3.93-5.25=15 5.26-6.54=16 6.55-8.23=17 8.24-8.57=18 8.58-20=19; invalue VocabHCh -15 - -9.91=1 -9.90 - -8.49=2 -8.48 - -7.43=3 -7.42 - -6.34=4 -6.33 - -5.26=5 -5.25 - -3.95=6 -3.94 - -3.23=7 -3.22 - -1.99=8 -1.98 - -0.80=9 -0.79 - 0.29=10 0.30-1.15=11 1.16-2.08=12 2.09-3.17=13 3.18-3.62=14 3.63-4.76=15 4.77-5.42=16 5.43-5.97=17 5.98-7.41=18 7.42-15=19; invalue DCCSMCh 0-0.16=2 0.17-0.30=3 0.31-0.39=4 0.40-0.65=5 0.66-1.64=6 1.65-5.00=7 5.01-6.50=8 6.51-7.16=9 7.17-7.67=10 7.68-7.94=11 7.95-8.29=12 8.30-8.62=13 8.63-9.00=14 9.01-9.33=15 9.34-9.65=16 9.66-9.92=17 9.93-10=18; invalue FlankMCh 0-0.80=2 0.81-1.40=3 1.41-1.64=4 1.65-1.86=5 1.87-2.98=6 2.99-5.23=7 5.24-7.28=8 7.29-8.07=9 8.08-8.39=10 8.40-8.78=11 8.79-9.20=12 9.21-9.36=13 9.37-9.58=14 9.59-9.68=15 9.69-9.79=16 9.80-9.92=17 9.93-10=18; invalue ListMCh 0-1=2 2-3=3 4=4 5=5 6-8=6 9-10=7 11-13=8 14-15=9 16=10 17-18=11 19=13 20-21=14 22=15 23=16 24-25=17 26=18; invalue PSMMCh 200-241.49=2 241.50-299.30=3 299.31-313.76=4 313.77-350.30=5 350.31-403.03=6 403.04-418.35=7 418.36-460.16=8 460.17-486.77=9 486.78-516.55=10 516.56-560.29=11 560.30-591.76=12 591.77-621.70=13 621.71-646.93=14 646.94-659.66=15 659.67-702.10=16 702.11-774.64=17 774.65-800=18; invalue PCMCh 0-11=2 12-19=3 20-22=4 23-28=5 29-31=6 32-38=7 39-42=8 43-48=9 49-52=10 53-56=11 57-60=12 61-64=13 65-68=14 69-72=15 73-75=16 76-96=17 97-130=18; invalue ReadMCh -30 - -25.79=2 -25.78 - -21.95=3 -21.94 - -20.82=4 -20.81 - -19.64=5 -19.63 - -17.54=6 -17.53 - -9.29=7 -9.28 - -2.57=8 -2.56 - -0.47=9 -0.46 - 0.65=10 0.66-1.86=11 1.87-3.04=12 3.05-3.85=13 3.86-4.46=14 4.47-5.72=15 5.73-6.75=16 6.76-12.61=17 12.62-20=18; invalue VocabMCh -15 - -12.04=2 -12.03 - -6.82=3 -6.81 - -6.73=4 -6.72 - -5.87=5 -5.86 - -4.23=6 -4.22 - -3.57=7 -3.56 - -2.19=8 -2.18 - -0.06=9 -0.05 - 1.30=10 1.31-2.12=11 2.13-3.02=12 3.03-3.84=13 3.85-4.40=14 4.41-5.10=15 5.11-6.45=16 6.46-11.94=17 11.95-15=18; run; data final; set combined; ComputedPatternComp = round(RawPatternComp*1.6559975-17.0012398, 1); ComputedPatternComp = max(of ComputedPatternComp RawPatternComp); if ThetaPSM = . then ThetaPSM = ComputedPSM/100 - 5.4; if ComputedPSM = . then ComputedPSM = (ThetaPSM + 5.4)*100; if 3 le age le 11 then NewComputedPSM = round((ThetaPSM+0.2178067+5.4)*100, 0.01); if 12 le age le 59 then NewComputedPSM = round((ThetaPSM+0.4479639+5.4)*100, 0.01); if 60 le age le 85 then NewComputedPSM = round((ThetaPSM+5.4)*100, 0.01); if ThetaEngVocab= . then ThetaEngVocab = ComputedEngVocab/100 - 12; if ThetaEngRead= . then ThetaEngRead = ComputedEngRead/100 - 16.1; ThetaEngRead = round(ThetaEngRead, 0.01); ComputedEngRead = round(ComputedEngRead, 1); DCCS=round(ComputedDCCS, 0.01); Flanker=round(ComputedFlanker, 0.01); List_sort=RawListSort; Pattern_comp=round(ComputedPatternComp, 1); Pic_mem=round(NewComputedPSM, 0.01); Eng_Vocab=round(ThetaEngVocab, 0.01); Eng_Reading=ThetaEngRead; *************************************************************************; *** Uncorrected Standard Scores ***; UncorrDCCS = ((DCCS - 7.71) / 1.71)*15 + 100; UncorrFlanker = ((Flanker - 8.29) / 1.48)*15 + 100; UncorrListSort = ((List_sort - 16.69) / 3.90)*15 + 100; UncorrPatternComp = ((Pattern_comp - 55.32) / 11.88)*15 + 100; UncorrPSM = ((ThetaPSM + 0.69051) / 0.94131)*15 + 100; UncorrEngRead = ((Eng_Reading - 2.80) / 5.20)*15 + 100; UncorrEngVocab = ((Eng_Vocab - 3.73) / 3.14)*15 + 100; Fluid = (UncorrDCCS + UncorrFlanker + UncorrListSort + UncorrPatternComp + UncorrPSM) / 5; Crystal = (UncorrEngRead + UncorrEngVocab) / 2; TempPSM = ((NewComputedPSM-505.59)/99.83)*15 + 100; Early = (UncorrDCCS + UncorrFlanker + TempPSM + UncorrEngVocab) / 4; UncorrFluid = ((Fluid - 100.89) / 10.77)*15 + 100; UncorrCrystal = ((Crystal - 100.38) / 13.99)*15 + 100; UncorrEarly = ((Early - 100.56) / 11.23)*15 + 100; Total = (UncorrFluid + UncorrCrystal) / 2; UncorrTotal = ((Total - 100.53) / 12.60)*15 + 100; *** Age-Corrected Standard Scores - Adults ***; if age ge 18 then do; DCCS_ss = input(DCCS, DCCSAd.); Flanker_ss = input(Flanker, FlankAd.); List_sort_ss = input(List_sort, ListAd.); Pattern_comp_ss = input(Pattern_comp, PCAd.); Pic_mem_ss = input(Pic_mem, PSMAd.); Eng_read_ss = input(Eng_Reading, ReadAd.); Eng_vocab_ss = input(Eng_Vocab, VocabAd.); AgeCorrDCCS = 100 + 15*((DCCS_ss - (14.82-9.83*(age/100))) / (2.17-0.62*(age/100)))/1.29; AgeCorrFlanker = 100 + 15*((Flanker_ss - (14.38-8.92*(age/100))) / (2.28-0.63*(age/100)))/1.28; AgeCorrListSort = 100 + 15*((List_sort_ss - (11.98-7.37*(age/100)*(age/100))) / (2.36-0.34*(age/100)))/1.23; AgeCorrPSM = 100 + 15*((Pic_mem_ss - (14.06-8.48*(age/100))) / (2.43-0.72*(age/100)))/1.25; AgeCorrPatternComp = 100 + 15*((Pattern_comp_ss - (14.68-9.62*(age/100))) / (2.33-0.74*(age/100)))/1.24; AgeCorrEngRead = 100 + 15*((Eng_read_ss - (9.68+0.65*(age/100))) / (1.81+1.19*(age/100)))/1.26; AgeCorrEngVocab = 100 + 15*((Eng_vocab_ss - (11.41-0.57*(100/age))) / (1.86+1.12*(age/100)))/1.24; Fluid_age = (AgeCorrDCCS + AgeCorrFlanker + AgeCorrListSort + AgeCorrPSM + AgeCorrPatternComp) / 5; Crystal_age = (AgeCorrEngRead + AgeCorrEngVocab) / 2; Early_age = (AgeCorrDCCS + AgeCorrFlanker + AgeCorrPSM + AgeCorrEngVocab) / 4; AgeCorrFluid = 100 + 15*((Fluid_age - 100.15) / 10.10); AgeCorrCrystal = 100 + 15*((Crystal_age - 100.18) / 13.64); AgeCorrEarly = 100 + 15*((Early_age - 100.14) / 10.60); Total_age = (AgeCorrFluid + AgeCorrCrystal) / 2; AgeCorrTotal = 100 + 15*((Total_age - 100.02) / 12.93); end; *** Age-Corrected Standard Scores - Children ***; if age < 18 then do; DCCS_ss = input(DCCS, DCCSCh.); Flanker_ss = input(Flanker, FlankCh.); List_sort_ss = input(List_sort, ListCh.); Pattern_comp_ss = input(Pattern_comp, PCCh.); Pic_mem_ss = input(Pic_mem, PSMCh.); Eng_read_ss = input(Eng_Reading, ReadCh.); Eng_vocab_ss = input(Eng_Vocab, VocabCh.); AgeCorrDCCS = 100 + 15*((DCCS_ss - (-2.02+11.67*sqrt(age/10))) / (1.35+0.69*log(age/10)+0.71*log(age/10)*log(age/10)))/1.28; AgeCorrFlanker = 100 + 15*((Flanker_ss - (-3.71+13.96*sqrt(age/10)-0.33*(age/10)**3)) / (-3.00+4.30*(age/10)**(-0.5)+3.07*log(age/10)))/1.29; AgeCorrListSort = 100 + 15*((List_sort_ss - (13.21-3.18*(age/10)**(-2)-1.98*log(age/10)*(age/10)**(-2))) / (2.04-0.33*(10/age)))/1.30; AgeCorrPSM = 100 + 15*((Pic_mem_ss - (-2.14+12.32*(age/10)-7.84*log(age/10)*(age/10))) / (1.14+0.64*(age/10)))/1.25; AgeCorrPatternComp = 100 + 15*((Pattern_comp_ss - (-1.20+10.85*sqrt(age/10))) / (-4.47+5.88*(age/10)**(-0.5)+3.67*log(age/10)))/1.29; AgeCorrEngRead = 100 + 15*((Eng_read_ss - (21.06-11.09*(10/age)-5.05*log(age/10)*(10/age))) / (9.97-8.81*(age/10)**(-0.5)-3.28*log(age/10)*(age/10)**(-0.5)))/1.31; AgeCorrEngVocab = 100 + 15*((Eng_vocab_ss - (2.19+8.25*(age/10)-0.64*(age/10)**3)) / (1.15+0.90*log(age/10)+0.88*(log(age/10))**2))/1.29; Fluid_age = (AgeCorrDCCS + AgeCorrFlanker + AgeCorrListSort + AgeCorrPSM + AgeCorrPatternComp) / 5; Crystal_age = (AgeCorrEngRead + AgeCorrEngVocab) / 2; Early_age = (AgeCorrDCCS + AgeCorrFlanker + AgeCorrPSM + AgeCorrEngVocab) / 4; AgeCorrFluid = 100 + 15*((Fluid_age - 100.24) / 9.24); AgeCorrCrystal = 100 + 15*((Crystal_age - 100.05) / 12.81); AgeCorrEarly = 100 + 15*((Early_age - 100.16) / 9.62); Total_age = (AgeCorrFluid + AgeCorrCrystal) / 2; AgeCorrTotal = 100 + 15*((Total_age - 100.25) / 12.48); end; *** Fully-Corrected T Scores - White/Asian Adults ***; if age ge 18 and group="W" then do; DCCS_fss = input(DCCS, DCCSWAd.); Flanker_fss = input(Flanker, FlankWAd.); List_sort_fss = input(List_sort, ListWAd.); Pattern_comp_fss = input(Pattern_comp, PCWAd.); Pic_mem_fss = input(Pic_mem, PSMWAd.); Eng_read_fss = input(Eng_Reading, ReadWAd.); Eng_vocab_fss = input(Eng_Vocab, VocabWAd.); FullTDCCS = 50 + 10*((DCCS_fss - (12.92-9.84*(age/100)+1.45*(edu_yrs/10)+0.30*Male)) / (1.78-0.63*(age/100)+0.16*(edu_yrs/10)+0.32*Male))/1.28; FullTFlanker = 50 + 10*((Flanker_fss - (15.52-9.25*(age/100)-1.53*(edu_yrs/10)**(-2)+0.29*Male)) / (2.23-0.72*(age/100)-0.10*(edu_yrs/10)+0.33*Male))/1.30; FullTListSort = 50 + 10*((List_sort_fss - (12.89-8.36*(age/100)+1.12*(edu_yrs/10)-0.25*Male)) / (1.80+0.06*(age/100)+0.25*(edu_yrs/10)-0.04*Male))/1.22; FullTPSM = 50 + 10*((Pic_mem_fss - (12.72-8.91*(age/100)+1.51*(edu_yrs/10)-0.97*Male)) / (2.42-0.49*(age/100)-0.17*(edu_yrs/10)-0.05*Male))/1.25; FullTPatternComp = 50 + 10*((Pattern_comp_fss - (10.50-9.42*(age/100)+3.75*(edu_yrs/10)**2-4.03*log(edu_yrs/10)*(edu_yrs/10)**2-0.28*Male)) / (2.06-0.82*(age/100)+0.08*(edu_yrs/10)+0.34*Male))/1.24; FullTEngRead = 50 + 10*((Eng_read_fss - (3.55+0.87*(age/100)+4.20*(edu_yrs/10)+0.18*Male)) / (-2.10+0.73*(age/100)+2.02*(edu_yrs/10)**(-2)+2.04*(edu_yrs/10)-0.16*Male))/1.25; FullTEngVocab = 50 + 10*((Eng_vocab_fss - (2.69+18.50*(age/100)**2-19.70*(age/100)**3+3.92*(edu_yrs/10)-0.09*Male)) / (0.82+1.09*(age/100)+0.52*(edu_yrs/10)+0.35*Male))/1.25; Fluid_f = (FullTDCCS + FullTFlanker + FullTListSort + FullTPSM + FullTPatternComp) / 5; Crystal_f = (FullTEngRead + FullTEngVocab) / 2; Early_f = (FullTDCCS + FullTFlanker + FullTPSM + FullTEngVocab) / 4; FullTFluid = 50 + 10*((Fluid_f - 50.13) / 6.60); FullTCrystal = 50 + 10*((Crystal_f - 50.10) / 8.95); FullTEarly = 50 + 10*((Early_f - 50.12) / 6.81); Total_f = (FullTFluid + FullTCrystal) / 2; FullTTotal = 50 + 10*((Total_f - 50.07) / 8.34); end; *** Fully-Corrected T Scores - African American Adults ***; if age ge 18 and group="B" then do; DCCS_fss = input(DCCS, DCCSAAd.); Flanker_fss = input(Flanker, FlankAAd.); List_sort_fss = input(List_sort, ListAAd.); Pattern_comp_fss = input(Pattern_comp, PCAAd.); Pic_mem_fss = input(Pic_mem, PSMAAd.); Eng_read_fss = input(Eng_Reading, ReadAAd.); Eng_vocab_fss = input(Eng_Vocab, VocabAAd.); FullTDCCS = 50 + 10*((DCCS_fss - (11.82-11.22*(age/100)+2.13*(edu_yrs/10)+0.32*Male)) / (3.04-1.17*(age/100)-0.44*(edu_yrs/10)+0.10*Male))/1.26; FullTFlanker = 50 + 10*((Flanker_fss - (11.77-7.52*(age/100)+1.07*(edu_yrs/10)+0.002*Male)) / (1.76+0.18*(age/100)+0.22*(edu_yrs/10)+0.37*Male))/1.24; FullTListSort = 50 + 10*((List_sort_fss - (12.42-7.41*(age/100)+0.57*(edu_yrs/10)+0.58*Male)) / (2.14+0.43*(age/100)-0.15*(edu_yrs/10)+0.06*Male))/1.30; FullTPSM = 50 + 10*((Pic_mem_fss - (13.73-5.86*(age/100)-0.67*(edu_yrs/10)-1.15*Male)) / (3.53-1.44*(age/100)-0.60*(edu_yrs/10)+0.72*Male))/1.25; FullTPatternComp = 50 + 10*((Pattern_comp_fss - (15.27-10.82*(age/100)-0.51*(edu_yrs/10)+0.66*Male)) / (2.50-0.72*(age/100)-0.24*(edu_yrs/10)+0.58*Male))/1.24; FullTEngRead = 50 + 10*((Eng_read_fss - (6.05-1.40*(age/100)+3.23*(edu_yrs/10)+0.17*Male)) / (1.95+1.09*(age/100)-0.16*(edu_yrs/10)+0.45*Male))/1.26; FullTEngVocab = 50 + 10*((Eng_vocab_fss - (0.56+3.11*(age/100)+5.81*(edu_yrs/10)-0.39*Male)) / (2.03-0.45*(age/100)+0.14*(edu_yrs/10)+0.20*Male))/1.27; Fluid_f = (FullTDCCS + FullTFlanker + FullTListSort + FullTPSM + FullTPatternComp) / 5; Crystal_f = (FullTEngRead + FullTEngVocab) / 2; Early_f = (FullTDCCS + FullTFlanker + FullTPSM + FullTEngVocab) / 4; FullTFluid = 50 + 10*((Fluid_f - 50.05) / 6.48); FullTCrystal = 50 + 10*((Crystal_f - 50.00) / 9.19); FullTEarly = 50 + 10*((Early_f - 50.02) / 7.09); Total_f = (FullTFluid + FullTCrystal) / 2; FullTTotal = 50 + 10*((Total_f - 50.02) / 8.68); end; *** Fully-Corrected T Scores - Hispanic Adults ***; if age ge 18 and group="H" then do; DCCS_fss = input(DCCS, DCCSHAd.); Flanker_fss = input(Flanker, FlankHAd.); List_sort_fss = input(List_sort, ListHAd.); Pattern_comp_fss = input(Pattern_comp, PCHAd.); Pic_mem_fss = input(Pic_mem, PSMHAd.); Eng_read_fss = input(Eng_Reading, ReadHAd.); Eng_vocab_fss = input(Eng_Vocab, VocabHAd.); FullTDCCS = 50 + 10*((DCCS_fss - (9.17-10.11*(age/100)+3.51*(edu_yrs/10)+0.18*Male)) / (2.18-0.36*(age/100)-0.11*(edu_yrs/10)+0.06*Male))/1.29; FullTFlanker = 50 + 10*((Flanker_fss - (11.56-10.32*(age/100)+1.68*(edu_yrs/10)+0.99*Male)) / (2.07-1.00*(age/100)+0.29*(edu_yrs/10)-0.46*Male))/1.30; FullTListSort = 50 + 10*((List_sort_fss - (11.27-9.35*(age/100)+1.27*(edu_yrs/10)+1.53*Male)) / (2.69-0.54*(age/100)-0.30*(edu_yrs/10)+0.30*Male))/1.20; FullTPSM = 50 + 10*((Pic_mem_fss - (11.19-8.84*(age/100)+1.63*(edu_yrs/10)+0.39*Male)) / (1.07+0.09*(age/100)+0.58*(edu_yrs/10)+0.44*Male))/1.27; FullTPatternComp = 50 + 10*((Pattern_comp_fss - (12.15-11.01*(age/100)+1.71*(edu_yrs/10)-0.13*Male)) / (1.83-0.63*(age/100)+0.34*(edu_yrs/10)+0.02*Male))/1.21; FullTEngRead = 50 + 10*((Eng_read_fss - (1.37+0.51*(age/100)+5.84*(edu_yrs/10)+0.40*Male)) / (1.66+2.08*(age/100)-0.33*(edu_yrs/10)+0.07*Male))/1.22; FullTEngVocab = 50 + 10*((Eng_vocab_fss - (0.74+5.17*(age/100)+4.91*(edu_yrs/10)+0.74*Male)) / (1.74+1.16*(age/100)-0.15*(edu_yrs/10)+0.07*Male))/1.23; Fluid_f = (FullTDCCS + FullTFlanker + FullTListSort + FullTPSM + FullTPatternComp) / 5; Crystal_f = (FullTEngRead + FullTEngVocab) / 2; Early_f = (FullTDCCS + FullTFlanker + FullTPSM + FullTEngVocab) / 4; FullTFluid = 50 + 10*((Fluid_f - 50.28) / 6.99); FullTCrystal = 50 + 10*((Crystal_f - 50.11) / 8.89); FullTEarly = 50 + 10*((Early_f - 50.08) / 7.00); Total_f = (FullTFluid + FullTCrystal) / 2; FullTTotal = 50 + 10*((Total_f - 49.83) / 8.46); end; *** Fully-Corrected T Scores - White/Asian Children ***; if age < 18 and group="W" then do; DCCS_fss = input(DCCS, DCCSWCh.); Flanker_fss = input(Flanker, FlankWCh.); List_sort_fss = input(List_sort, ListWCh.); Pattern_comp_fss = input(Pattern_comp, PCWCh.); Pic_mem_fss = input(Pic_mem, PSMWCh.); Eng_read_fss = input(Eng_Reading, ReadWCh.); Eng_vocab_fss = input(Eng_Vocab, VocabWCh.); FullTDCCS = 50 + 10*((DCCS_fss - (-3.61+12.13*sqrt(age/10)+0.85*(edu_yrs/10)**3-1.08*log(edu_yrs/10)*(edu_yrs/10)**3-0.24*Male)) / (0.88+0.60*(age/10)-0.13*(edu_yrs/10)+0.08*Male))/1.29; FullTFlanker = 50 + 10*((Flanker_fss - (0.09+11.66*(age/10)-2.71*(age/10)**2+0.60*(edu_yrs/10)+0.02*Male)) / (8.45-7.31*(age/10)**(-0.5)-2.70*log(age/10)*(age/10)**(-0.5)+0.09*(edu_yrs/10)+0.07*Male))/1.28; FullTListSort = 50 + 10*((List_sort_fss - (11.90-3.31*(age/10)**(-2)-2.09*log(age/10)*(age/10)**(-2)+1.17*(edu_yrs/10)-0.05*Male)) / (2.06-0.56*(age/10)**(-2)-0.39*log(age/10)*(age/10)**(-2)+0.17*(edu_yrs/10)+0.05*Male))/1.27; FullTPSM = 50 + 10*((Pic_mem_fss - (17.14-7.68*(age/10)**(-0.5)+0.56*(edu_yrs/10)-0.11*Male)) / (1.07+0.60*(age/10)+0.08*(edu_yrs/10)-0.001*Male))/1.25; FullTPatternComp = 50 + 10*((Pattern_comp_fss - (-2.04+11.23*sqrt(age/10)+0.47*(edu_yrs/10)-0.29*Male)) / (1.31+0.71*log(age/10)+0.74*(log(age/10))**2+0.03*(edu_yrs/10)+0.06*Male))/1.31; FullTEngRead = 50 + 10*((Eng_read_fss - (7.68+0.26*(age/10)**(-2)+6.78*log(age/10)+1.42*(edu_yrs/10)-0.03*Male)) / (5.48+2.46*(10/age)-7.02*(age/10)**(-0.5)+0.13*(edu_yrs/10)+0.09*Male))/1.30; FullTEngVocab = 50 + 10*((Eng_vocab_fss - (0.52+8.27*(age/10)-0.58*(age/10)**3+0.98*(edu_yrs/10)**3-1.15*log(edu_yrs/10)*(edu_yrs/10)**3+0.19*Male)) / (9.71-9.04*(age/10)**(-0.5)-3.56*log(age/10)*(age/10)**(-0.5)+0.26*(edu_yrs/10)+0.15*Male))/1.27; Fluid_f = (FullTDCCS + FullTFlanker + FullTListSort + FullTPSM + FullTPatternComp) / 5; Crystal_f = (FullTEngRead + FullTEngVocab) / 2; Early_f = (FullTDCCS + FullTFlanker + FullTPSM + FullTEngVocab) / 4; FullTFluid = 50 + 10*((Fluid_f - 50.09) / 5.95); FullTCrystal = 50 + 10*((Crystal_f - 49.96) / 8.45); FullTEarly = 50 + 10*((Early_f - 49.99) / 6.20); Total_f = (FullTFluid + FullTCrystal) / 2; FullTTotal = 50 + 10*((Total_f - 50.08) / 8.11); end; *** Fully-Corrected T Scores - African American Children ***; if age < 18 and group="B" then do; DCCS_fss = input(DCCS, DCCSACh.); Flanker_fss = input(Flanker, FlankACh.); List_sort_fss = input(List_sort, ListACh.); Pattern_comp_fss = input(Pattern_comp, PCACh.); Pic_mem_fss = input(Pic_mem, PSMACh.); Eng_read_fss = input(Eng_Reading, ReadACh.); Eng_vocab_fss = input(Eng_Vocab, VocabACh.); FullTDCCS = 50 + 10*((DCCS_fss - (9.35+5.30*log(age/10)+0.42*(edu_yrs/10)-0.10*Male)) / (1.30+0.44*(age/10)-0.10*(edu_yrs/10)-0.07*Male))/1.27; FullTFlanker = 50 + 10*((Flanker_fss - (9.51+5.53*log(age/10)+0.29*(edu_yrs/10)-0.06*Male)) / (0.48+0.86*(age/10)+0.07*(edu_yrs/10)+0.02*Male))/1.26; FullTListSort = 50 + 10*((List_sort_fss - (18.20-9.53*(age/10)**(-0.5)+0.91*(edu_yrs/10)+0.41*Male)) / (0.86+0.57*(age/10)+0.16*(edu_yrs/10)+0.16*Male))/1.26; FullTPSM = 50 + 10*((Pic_mem_fss - (16.40-7.70*(age/10)**(-0.5)+1.03*(edu_yrs/10)-0.09*Male)) / (1.14+0.60*(age/10)+0.15*(edu_yrs/10)-0.02*Male))/1.22; FullTPatternComp = 50 + 10*((Pattern_comp_fss - (23.25+1.02*(age/10)**(-2)-15.13*(age/10)**(-0.5)+0.54*(edu_yrs/10)-0.29*Male)) / (2.92-0.88*(age/10)**(-2)-0.89*log(age/10)*(age/10)**(-2)-0.37*(edu_yrs/10)+0.06*Male))/1.27; FullTEngRead = 50 + 10*((Eng_read_fss - (-0.73+10.54*(age/10)-1.31*(age/10)**3+1.26*(edu_yrs/10)-0.01*Male)) / (0.04+1.02*(age/10)+0.11*(edu_yrs/10)+0.19*Male))/1.31; FullTEngVocab = 50 + 10*((Eng_vocab_fss - (1.90+9.41*(age/10)**2-3.82*(age/10)**3+1.58*(edu_yrs/10)+0.34*Male)) / (0.89+0.63*(age/10)-0.20*(edu_yrs/10)+0.22*Male))/1.30; Fluid_f = (FullTDCCS + FullTFlanker + FullTListSort + FullTPSM + FullTPatternComp) / 5; Crystal_f = (FullTEngRead + FullTEngVocab) / 2; Early_f = (FullTDCCS + FullTFlanker + FullTPSM + FullTEngVocab) / 4; FullTFluid = 50 + 10*((Fluid_f - 50.15) / 6.24); FullTCrystal = 50 + 10*((Crystal_f - 49.96) / 8.52); FullTEarly = 50 + 10*((Early_f - 50.18) / 6.66); Total_f = (FullTFluid + FullTCrystal) / 2; FullTTotal = 50 + 10*((Total_f - 50.37) / 8.30); end; *** Fully-Corrected T Scores - Hispanic Children ***; if age < 18 and group="H" then do; DCCS_fss = input(DCCS, DCCSHCh.); Flanker_fss = input(Flanker, FlankHCh.); List_sort_fss = input(List_sort, ListHCh.); Pattern_comp_fss = input(Pattern_comp, PCHCh.); Pic_mem_fss = input(Pic_mem, PSMHCh.); Eng_read_fss = input(Eng_Reading, ReadHCh.); Eng_vocab_fss = input(Eng_Vocab, VocabHCh.); FullTDCCS = 50 + 10*((DCCS_fss - (-2.27+11.50*sqrt(age/10)+0.48*(edu_yrs/10)-0.05*Male)) / (1.06+0.43*(age/10)-0.09*(edu_yrs/10)+0.10*Male))/1.30; FullTFlanker = 50 + 10*((Flanker_fss - (9.58+5.25*log(age/10)+0.31*(edu_yrs/10)+0.37*Male)) / (0.91+0.72*(age/10)-0.41*(edu_yrs/10)**3+0.74*log(edu_yrs/10)*(edu_yrs/10)**3+0.20*Male))/1.31; FullTListSort = 50 + 10*((List_sort_fss - (17.70-8.99*(age/10)**(-0.5)+1.17*(edu_yrs/10)+0.26*Male)) / (1.12+0.48*(age/10)-0.004*(edu_yrs/10)+0.12*Male))/1.24; FullTPSM = 50 + 10*((Pic_mem_fss - (16.35-7.57*(age/10)**(-0.5)+1.22*(edu_yrs/10)+0.12*Male)) / (1.44+0.75*(age/10)-0.43*(edu_yrs/10)+0.07*Male))/1.25; FullTPatternComp = 50 + 10*((Pattern_comp_fss - (-1.06+10.96*(age/10)**(0.5)+0.07*(edu_yrs/10)-0.21*Male)) / (0.32+0.63*(age/10)+0.42*(edu_yrs/10)+0.07*Male))/1.29; FullTEngRead = 50 + 10*((Eng_read_fss - (16.38+1.43*(age/10)**(-2)-8.60*(10/age)+0.93*(edu_yrs/10)-0.03*Male)) / (0.72+0.84*(age/10)-0.37*(edu_yrs/10)**3+0.68*log(edu_yrs/10)*(edu_yrs/10)**3+0.03*Male))/1.35; FullTEngVocab = 50 + 10*((Eng_vocab_fss - (-3.46+11.91*sqrt(age/10)+1.18*(edu_yrs/10)+0.04*Male)) / (0.67+0.56*(age/10)-0.10*(edu_yrs/10)+0.16*Male))/1.29; Fluid_f = (FullTDCCS + FullTFlanker + FullTListSort + FullTPSM + FullTPatternComp) / 5; Crystal_f = (FullTEngRead + FullTEngVocab) / 2; Early_f = (FullTDCCS + FullTFlanker + FullTPSM + FullTEngVocab) / 4; FullTFluid = 50 + 10*((Fluid_f - 50.06) / 6.18); FullTCrystal = 50 + 10*((Crystal_f - 49.99) / 8.58); FullTEarly = 50 + 10*((Early_f - 50.07) / 6.14); Total_f = (FullTFluid + FullTCrystal) / 2; FullTTotal = 50 + 10*((Total_f - 50.21) / 8.03); end; *** Fully-Corrected T Scores - Multiracial Children ***; if age < 18 and group="M" then do; DCCS_fss = input(DCCS, DCCSMCh.); Flanker_fss = input(Flanker, FlankMCh.); List_sort_fss = input(List_sort, ListMCh.); Pattern_comp_fss = input(Pattern_comp, PCMCh.); Pic_mem_fss = input(Pic_mem, PSMMCh.); Eng_read_fss = input(Eng_Reading, ReadMCh.); Eng_vocab_fss = input(Eng_Vocab, VocabMCh.); FullTDCCS = 50 + 10*((DCCS_fss - (2.23+5.84*(age/10)+1.31*(edu_yrs/10)+0.07*Male)) / (0.03+0.30*(age/10)+0.87*(edu_yrs/10)+0.02*Male))/1.23; FullTFlanker = 50 + 10*((Flanker_fss - (-4.21+11.60*sqrt(age/10)+2.12*(edu_yrs/10)+0.24*Male)) / (1.61+0.47*(age/10)-0.59*(edu_yrs/10)-0.19*Male))/1.23; FullTListSort = 50 + 10*((List_sort_fss - (17.96-8.02*(age/10)**(-0.5)+0.33*(edu_yrs/10)+0.12*Male)) / (1.80+0.36*(age/10)-0.18*(edu_yrs/10)-0.28*Male))/1.22; FullTPSM = 50 + 10*((Pic_mem_fss - (5.70+4.34*log(age/10)+3.23*(edu_yrs/10)+0.91*Male)) / (1.56+0.43*(age/10)-0.38*(edu_yrs/10)+0.16*Male))/1.24; FullTPatternComp = 50 + 10*((Pattern_comp_fss - (2.83+5.98*(age/10)+0.81*(edu_yrs/10)+0.15*Male)) / (0.69+0.47*(age/10)+0.03*(edu_yrs/10)+0.29*Male))/1.25; FullTEngRead = 50 + 10*((Eng_read_fss - (7.68+5.02*log(age/10)+2.11*(edu_yrs/10)+0.32*Male)) / (-0.87+0.86*(age/10)+0.93*(edu_yrs/10)+0.04*Male))/1.35; FullTEngVocab = 50 + 10*((Eng_vocab_fss - (7.10+5.15*log(age/10)+3.01*(edu_yrs/10)-0.76*Male)) / (0.49+0.76*(age/10)-0.10*(edu_yrs/10)-0.16*Male))/1.23; Fluid_f = (FullTDCCS + FullTFlanker + FullTListSort + FullTPSM + FullTPatternComp) / 5; Crystal_f = (FullTEngRead + FullTEngVocab) / 2; Early_f = (FullTDCCS + FullTFlanker + FullTPSM + FullTEngVocab) / 4; FullTFluid = 50 + 10*((Fluid_f - 50.53) / 6.51); FullTCrystal = 50 + 10*((Crystal_f - 50.29) / 8.03); FullTEarly = 50 + 10*((Early_f - 50.91) / 6.86); Total_f = (FullTFluid + FullTCrystal) / 2; FullTTotal = 50 + 10*((Total_f - 50.86) / 8.48); end; drop AgeGroup DCCSrt FlankerRT DCCS Flanker List_sort Pattern_comp Pic_mem Eng_Vocab Eng_Reading Fluid Crystal Early Total TempPSM DCCS_ss Flanker_ss List_sort_ss Pattern_comp_ss Pic_mem_ss Eng_Vocab_ss Eng_Read_ss Fluid_age Crystal_age Early_age Total_age DCCS_fss Flanker_fss List_sort_fss Pattern_comp_fss Pic_mem_fss Eng_Vocab_fss Eng_Read_fss Fluid_f Crystal_f Early_f Total_f ComputedPSM Name ; run; data final; set final; rename NewComputedPSM=ComputedPSM; run; data final; format pin Assessment_Name Name Age Male Group edu_yrs RawDCCS DCCSaccuracy DCCSreactiontime ComputedDCCS UncorrDCCS AgeCorrDCCS FullTDCCS RawFlanker FlankerAccuracy FlankerReactionTime ComputedFlanker UncorrFlanker AgeCorrFlanker FullTFlanker RawPSM ThetaPSM ComputedPSM UncorrPSM AgeCorrPSM FullTPSM RawPatternComp ComputedPatternComp UncorrPatternComp AgeCorrPatternComp FullTPatternComp RawListSort UncorrListSort AgeCorrListSort FullTListSort ThetaEngRead ComputedEngRead UncorrEngRead AgeCorrEngRead FullTEngRead ThetaEngVocab ComputedEngVocab UncorrEngVocab AgeCorrEngVocab FullTEngVocab UncorrFluid AgeCorrFluid FullTFluid UncorrCrystal AgeCorrCrystal FullTCrystal UncorrTotal AgeCorrTotal FullTTotal UncorrEarly AgeCorrEarly FullTEarly ; set final; array toround UncorrDCCS AgeCorrDCCS FullTDCCS UncorrFlanker AgeCorrFlanker FullTFlanker UncorrPSM AgeCorrPSM FullTPSM UncorrPatternComp AgeCorrPatternComp FullTPatternComp UncorrListSort AgeCorrListSort FullTListSort UncorrEngRead AgeCorrEngRead FullTEngRead UncorrEngVocab AgeCorrEngVocab FullTEngVocab UncorrFluid AgeCorrFluid FullTFluid UncorrCrystal AgeCorrCrystal FullTCrystal UncorrTotal AgeCorrTotal FullTTotal UncorrEarly AgeCorrEarly FullTEarly ; do over toround; toround=round(toround, 1); end; run; proc datasets library=work nolist; modify final; attrib _all_ label=''; quit; /* proc datasets lib=work nolist; save final; quit;*/ run; %mend; ** Macro call **; %TBrescore(path=H:/Toolbox/iPad/SAS Rescoring program, reg=Real Data Before Registration, scores=Real Data Before Scores, assessment=Real Data Before Assessment Data); proc print data=final; var PIN UncorrEarly; run;