Desktop productivity for business analysts and programmers

Lesion diameter summary check

Reply
Occasional Contributor
Posts: 9

Lesion diameter summary check

Hi,

The following program produces output summarizing the changes in a sum of lesion diameters by comparing each sum to the smallest sum occurring previously. What I'd like to do is modify it so it compares each sum to the baseline value. Any suggestions on the most efficient way to do this?

data SUMCHECK;
set SASUSER.QUERY_FOR_LS_SAS7BDAT_0006;
retain MINLDSUM;
by SUBJID;
if FIRST.SUBJID then do;
MINLDSUM=.;
LDSUMCHG=.;
end;
LDSUMCHG=(LDSUM-MINLDSUM)/MINLDSUM;
MINLDSUM=min(MINLDSUM,LDSUM);
format LDSUMCHG 8.3;
run

Many thanks in advance,

John
Super Contributor
Super Contributor
Posts: 3,174

Re: Lesion diameter summary check

Where does your baseline information reside?

Also, you have logic that will not work, because you are performing a subtraction with FIRST.SUBJID where MINLDSUM is assigned to a MISSING value. Consider looking into using the SUM function and code a -MINLDSUM as one argument.

Suggest you use the PUTLOG _ALL_; statement to debug your program at various points along the DATA step path progression.

Scott Barry
SBBWorks, Inc.
Occasional Contributor
Posts: 9

Re: Lesion diameter summary check

The baseline sum exists in the LDSUM variable in the SASUSER.QUERY_FOR_LS_SAS7BDAT_0006 dataset. All of the sums exist in the LDSUM variable and would be distinguished from each other by the date variable.

As for the current program I posted, it runs fine and produces valid output, as posted below. I get lots of 0's that are irrelevant but I can ignore them.

SUBJID LSVIS LSVISCD LSNUM LSSITE LSDESC LSDTN LSMTD LSDIA LSDIAU LDSUM MINLDSUM LDSUMCHG
001-001 PRE-STUDY 1 1 LUNG LEFT UPPER LOBE 06Jul2008 SPIRAL CT 11 cm 23.2 23.2
001-001 PRE-STUDY 1 2 LYMPH NODE LEFT AXILLA 06Jul2008 SPIRAL CT 2.3 cm 23.2 23.2 0.000
001-001 PRE-STUDY 1 3 LYMPH NODE PRE-VASCULAR 06Jul2008 SPIRAL CT 2.9 cm 23.2 23.2 0.000
001-001 PRE-STUDY 1 4 LYMPH NODE AORTICOPULMONARY 06Jul2008 SPIRAL CT 2.7 cm 23.2 23.2 0.000
001-001 PRE-STUDY 1 5 LYMPH NODE AORTICOPULMONARY #2 06Jul2008 SPIRAL CT 3.1 cm 23.2 23.2 0.000
001-001 PRE-STUDY 1 6 LYMPH NODE PRE-CARINAL 06Jul2008 SPIRAL CT 1.2 cm 23.2 23.2 0.000
001-001 CYCLE 2 2 1 LUNG LEFT UPPER LOBE 19Aug2008 SPIRAL CT 5.5 cm 13 13 -0.440
001-001 CYCLE 2 2 2 LYMPH NODE LEFT AXILLA 19Aug2008 SPIRAL CT 0.9 cm 13 13 0.000
001-001 CYCLE 2 2 3 LYMPH NODE PRE-VASCULAR 19Aug2008 SPIRAL CT 2.3 cm 13 13 0.000
001-001 CYCLE 2 2 4 LYMPH NODE ARTICOPULMONARY 19Aug2008 SPIRAL CT 1.9 cm 13 13 0.000
001-001 CYCLE 2 2 5 LYMPH NODE AORTICOPULMONARY #2 19Aug2008 SPIRAL CT 1.5 cm 13 13 0.000
001-001 CYCLE 2 2 6 LYMPH NODE PRE-CARNIAL 19Aug2008 SPIRAL CT 0.9 cm 13 13 0.000
001-001 CYCLE 4 3 1 LUNG LEFT UPPER LOBE 02Oct2008 SPIRAL CT 4.1 cm 8.6 8.6 -0.338
001-001 CYCLE 4 3 2 LYMPH NODE LEFT AXILLA 02Oct2008 SPIRAL CT 0 cm 8.6 8.6 0.000
001-001 CYCLE 4 3 3 LYMPH NODE PRE-VASCULAR 02Oct2008 SPIRAL CT 1.3 cm 8.6 8.6 0.000
001-001 CYCLE 4 3 4 LYMPH NODE AORTICOPULMONARY 02Oct2008 SPIRAL CT 1.4 cm 8.6 8.6 0.000
001-001 CYCLE 4 3 5 LYMPH NODE AORTICOPULMONARY #2 02Oct2008 SPIRAL CT 1 cm 8.6 8.6 0.000
001-001 CYCLE 4 3 6 LYMPH NODE PRE-CARINAL 02Oct2008 SPIRAL CT 0.8 cm 8.6 8.6 0.000
001-001 CYCLE 6 4 1 LUNG LEFT UPPER LOBE 18Nov2008 SPIRAL CT 3.2 cm 7.6 7.6 -0.116
001-001 CYCLE 6 4 2 LYMPH NODE LEFT AXILLA 18Nov2008 SPIRAL CT 0 cm 7.6 7.6 0.000
001-001 CYCLE 6 4 3 LYMPH NODE PRE-VASCULAR 18Nov2008 SPIRAL CT 1.3 cm 7.6 7.6 0.000
001-001 CYCLE 6 4 4 LYMPH NODE AORTICOPULMONARY 18Nov2008 SPIRAL CT 1.5 cm 7.6 7.6 0.000
001-001 CYCLE 6 4 5 LYMPH NODE AORTICOPULMONARY #2 18Nov2008 SPIRAL CT 0.8 cm 7.6 7.6 0.000
001-001 CYCLE 6 4 6 LYMPH NODE PRE-CARINAL 18Nov2008 SPIRAL CT 0.8 cm 7.6 7.6 0.000
001-001 CYCLE 9 7 1 LUNG LEFT UPPER LOBE 18Mar2009 SPIRAL CT 2.6 cm 4.8 4.8 -0.368
001-001 CYCLE 9 7 2 LYMPH NODE LEFT AXILLA 18Mar2009 SPIRAL CT 0 cm 4.8 4.8 0.000
001-001 CYCLE 9 7 3 LYMPH NODE PRE-VASCULAR 18Mar2009 SPIRAL CT 0 cm 4.8 4.8 0.000
001-001 CYCLE 9 7 4 LYMPH NODE AORTIOCOPULMONARY 18Mar2009 SPIRAL CT 0.9 cm 4.8 4.8 0.000
001-001 CYCLE 9 7 5 LYMPH NODE AORTIOCOPULMONARY #2 18Mar2009 SPIRAL CT 0.5 cm 4.8 4.8 0.000
001-001 CYCLE 9 7 6 LYMPH NODE PRE-CARINAL 18Mar2009 SPIRAL CT 0.8 cm 4.8 4.8 0.000
001-001 CYCLE 11 8 1 LUNG LEFT UPPER LOBE 08Apr2009 SPIRAL CT 2.4 cm 4.5 4.5 -0.062
001-001 CYCLE 11 8 2 LYMPH NODE LEFT AXILLA 08Apr2009 SPIRAL CT 0 cm 4.5 4.5 0.000
001-001 CYCLE 11 8 3 LYMPH NODE PRE-VASCULAR 08Apr2009 SPIRAL CT 0 cm 4.5 4.5 0.000
001-001 CYCLE 11 8 4 LYMPH NODE ANTICOPULMONARY 08Apr2009 SPIRAL CT 0.9 cm 4.5 4.5 0.000
001-001 CYCLE 11 8 5 LYMPH NODE ANTICOPULMONARY #2 08Apr2009 SPIRAL CT 0.5 cm 4.5 4.5 0.000
001-001 CYCLE 11 8 6 LYMPH NODE PRECARONAL 08Apr2009 SPIRAL CT 0.7 cm 4.5 4.5 0.000
001-001 UNSCHEDULED 5 1 LUNG LEFT UPPER LOBE 08May2009 SPIRAL CT 2.5 cm 4.6 4.5 0.022
001-001 UNSCHEDULED 5 2 LUNG LEFT AXILLA 08May2009 SPIRAL CT 0 cm 4.6 4.5 0.022
001-001 UNSCHEDULED 5 3 LYMPH NODE PRE-VASCULAR 08May2009 SPIRAL CT 0 cm 4.6 4.5 0.022
001-001 UNSCHEDULED 5 4 LYMPH NODE AORTICOPULMONARY 08May2009 SPIRAL CT 0.8 cm 4.6 4.5 0.022
001-001 UNSCHEDULED 5 5 LYMPH NODE AORTICOPULMONARY #2 08May2009 SPIRAL CT 0.5 cm 4.6 4.5 0.022
001-001 UNSCHEDULED 5 6 LYMPH NODE PRECARINAL 08May2009 SPIRAL CT 0.8 cm 4.6 4.5 0.022
001-001 CYCLE 13 9 1 LUNG LEFT UPPER LOBE 01Jun2009 SPIRAL CT 2.5 cm 7 4.5 0.556
001-001 CYCLE 13 9 2 LYMPH NODE LEFT AXILLA 01Jun2009 SPIRAL CT 0 cm 7 4.5 0.556
001-001 CYCLE 13 9 3 LYMPH NODE PRE-VASCULAR 01Jun2009 SPIRAL CT 0 cm 7 4.5 0.556
001-001 CYCLE 13 9 4 LYMPH NODE AORTICOPULMONARY 01Jun2009 SPIRAL CT 0.9 cm 7 4.5 0.556
001-001 CYCLE 13 9 5 LYMPH NODE AORTICOPULMONARY #2 01Jun2009 SPIRAL CT 0.6 cm 7 4.5 0.556
001-001 CYCLE 13 9 6 LYMPH NODE PRECARINAL 01Jun2009 SPIRAL CT 0.8 cm 7 4.5 0.556
001-001 CYCLE 13 9 7 SKIN/SOFT TISSUE PERICARDIAL FAT 01Jun2009 SPIRAL CT 2.2 cm 7 4.5 0.556
Super Contributor
Super Contributor
Posts: 3,174

Re: Lesion diameter summary check

Look at using PROC SUMMARY to create a total by SUBJID and then use a DATA step MERGE with a BY to merge back onto your data file with your SUM total for analysis. It's possible as well with PROC SQL and a JOIN.

Scott Barry
SBBWorks, Inc.

Recommended Google advanced search arguments, this topic/post:

data step merge processing site:sas.com

data step merge processing column total site:sas.com

proc sql join calculate total site:sas.com
Occasional Contributor
Posts: 9

Re: Lesion diameter summary check

Thanks Scott, your input is appreciated!

John
Ask a Question
Discussion stats
  • 4 replies
  • 159 views
  • 0 likes
  • 2 in conversation