Hi,
I was running some code and ended up with the following note. I'm not quite sure how to fix it. Can anybody help please? Thank you!
The note refers to this calculation:
323 duration= lcontdt-fdosedt+1;
It's telling you that for 6 observations, the calculation could not be made because either LCONTDT is missing or FDOSEDT is missing (or both are missing). Your best recourse is to find out what those values should be, and fix the data. But if that's not possible, then the calculations just can't be made.
Notice that the data sets you are merging contain different numbers of observations: 83 observations in one, but only 77 observations in the other. On a related note, it's super important that you read the log! So there are probably some mismatches when you merge, causing one of the variables to be missing.
This happens because either lcontdt or fdosedt contains missing values. An arithmetic operation that contains a missing value will also be missing in SAS.
@Patelbb wrote:
Hi,
I was running some code and ended up with the following note. I'm not quite sure how to fix it. Can anybody help please? Thank you!
313 **-------------------------------------------------------------------------------**;
314 ** MERGE X_DS AND STUDYRX DATASETS TOGETHER **;
315 **-------------------------------------------------------------------------------**;
316 data merged(drop=complete s_dsdc s_dsterm lcontdt fdosedt);
317 merge studyrx(in=studyrx)
318 x_ds(in=x_ds);
319 by s_subjid;
320
321
322 ** duration on study calculation;
323 duration= lcontdt-fdosedt+1;
324
325 ** study dispostion should create/display as 'STUDY COMPLETED' when complete=YES;
326 if complete= 'YES' then study= "STUDY COMPLETED";
327 else study= trim(compress(s_dsdc) || '(' || trim(compress(s_dsterm)) || ')');
328
329 run;NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line):(Column).
6 at 323:22
Here's a quick lesson in reading these error messages. Note the colour coding that lines up the instructions on how to find the issue.
First identify the line, which it gives you explicitly as 323.
Then the issue is at 22 characters in, I added 1234567890 underneath, each 0, is a 10, so second 0 is 20, and 22 is 2 in red. That indicates the issue is at fdosedt.
323 duration= lcontdt-fdosedt+1;
12345678901234567890123
When you do math on missing values it returns missing, which is why this note/warning shows up. You can get rid of it in several ways, one is change it to a function (SUM() vs +) which will treat missing as 0, or do the calculation conditionallly, add an IF statement to control the calculation so it only happens when fdosedt is not missing.
@Reeza wrote:
Then the issue is at 22 characters in, I added 1234567890 underneath, each 0, is a 10, so second 0 is 20, and 22 is 2 in red. That indicates the issue is at fdosedt.
323 duration= lcontdt-fdosedt+1;
12345678901234567890123
Hi @Reeza,
I agree that it's helpful to study these notes in the log, but I think the column number (22) points to the minus sign in this case, i.e., to where the first "operation on missing values" in this line occurred. It doesn't reveal whether lcontdt or fdosedt contains the missing value if not both are missing. (At least I can't see a difference in my PC SAS 9.4 log.)
@FreelanceReinh wrote:
@Reeza wrote:
Then the issue is at 22 characters in, I added 1234567890 underneath, each 0, is a 10, so second 0 is 20, and 22 is 2 in red. That indicates the issue is at fdosedt.
323 duration= lcontdt-fdosedt+1;
12345678901234567890123
Hi @Reeza,
I agree that it's helpful to study these notes in the log, but I think the column number (22) points to the minus sign in this case, i.e., to where the first "operation on missing values" in this line occurred. It doesn't reveal whether lcontdt or fdosedt contains the missing value if not both are missing. (At least I can't see a difference in my PC SAS 9.4 log.)
You are correct, the column indicator is not exactly correct so OP should check all variables involved in the calculation.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.