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?
if FIRST.SUBJID then do;
format LDSUMCHG 8.3;
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.
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.
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.
Recommended Google advanced search arguments, this topic/post:
data step merge processing site:sas.com
data step merge processing column total site:sas.com