Easy part first:
One of the things that the log is saying that I'm really not sure about is this:
NOTE: Variable AgeAtVisit is uninitialized.
NOTE: Variable InDemogs is uninitialized.
NOTE: Variable InVitals is uninitialized.
NOTE: Variable Indvbl is uninitialized.
This occurs when you use a variable name that has no values.
Likely cause for some spelling:
Merge HypTabs.Demog (IN = InDemog Drop = EthRaceCd)
Hyptabs.Contact (IN= InContact Keep= SSN StateCd)
Work.LastVitals (IN = InLastVitals Drop= HtIN)
Hyptabs.NDI (IN= INNDI Drop=Deathdt ICD10 CODCD);
By SSN;
IF Incontact=1 AND
InDemogs = 1 AND
InVitals = 1;
If Indvbl = . THEN Hypre1DeathInd = 0;
Else IF Indvbl = 0 THEN HypReIDeathInd= 0;
ELSE IF IndVbl = 1 THEN HypRelDeathInd = 1;
Your Retain and Format AgeAtVisit, you assign a value to AgeAtVisit1. If AgeAtVisit is NOT in one of the data sets, which it isn't because you did not KEEP it, then there is no value and causes the note for that variable. BTW you are getting luck with the YRDIF function. It is default to "AGE" as the basis. AgeAtVisit is not a valid basis value. Sort of surprised you don't get a warning or error from that use.
The only place Indvbl appears is in those If statements. It is not a variable kept from one of the sets and is not the name of one of the IN= created variables. From the other spellling errors I suspect it was intended.
When asking questions about why you don't get an expected number of observations as a minimum you should include the entire log with ALL the notes, warnings and such. That will tell us how many records each of the contributing data sets brings in.
You have a subsetting IF that can never be true because of two variables misspelled. So that would be the main cause for getting 0 observations:
IF Incontact=1 AND
InDemogs = 1 AND
InVitals = 1;
You have a
Merge BY SSN;
HyTabs.Contact is the only data set shown with the SSN variable. So does your code throw a number of ERRORS about missing BY variables.
Now for the fun part.
Why do you think there should be 573 observations? Is that the number of one of the sets? If so, which one?