Hi,
I have two datasets and am merging them.
I want to know what call missing is doing specifically here!!!!
After outputting why do we need to set them to missing again?????
We are not retaining the missing values and how does it affect the fresh records??????
I have the log shown as well!!
BASICALLY WE ARE NOT TELLING ANYWHERE IN THE CODE THAT SPECIFICALLY WE WANT THE NEXT RECORD TO HAVE THOSE VARIABLES SET TO MISSING!!!!!
data diag;
input person diag ;
cards;
101 999
101 888
101 777
101 666
101 555
;
data proc ;
input person proc;
cards;
101 111
101 222
101 333
;
data want ;
merge diag proc;
by person;
output;
call missing(diag,proc);
putlog _all_;
run;
101 diag=. proc=. FIRST.person=1 LAST.person=0 _ERROR_=0 _N_=1
101 diag=. proc=. FIRST.person=0 LAST.person=0 _ERROR_=0 _N_=2
101 diag=. proc=. FIRST.person=0 LAST.person=0 _ERROR_=0 _N_=3
101 diag=. proc=. FIRST.person=0 LAST.person=0 _ERROR_=0 _N_=4
101 diag=. proc=. FIRST.person=0 LAST.person=1 _ERROR_=0 _N_=5
It was just a another word for djag and proc in your specific example. Call missing has generally nothing to do with BY.
Well, you should be able to see what the effect by looking in resulting dataset.
Since there are repeating records with the same by variable, the last record from the dataset with fewer records will stay in the PDV, kind of a implicit retain. Call missing will in this case set the non by variables to null after the first merging record.
What is the source of this situation? Merging data with repeated by variables in both tables are usually not seen as best practice!
I get tthe right answer but wanted a clarification for the code...
Even if it is Many to Many I wanted to merge and not retain the previous value which SAS does Usually
So after the first record is output.....the same record is set to missing for the specified variables.....Then brings the values in the second record plugs them in ......OUTPUTS...then sets the same to missing for those vars.......Brings the values from the third .and so on
Is that RIGHT?????
Hi,
Could you also explain whats the meaning of "non by variables" in the below
"Call missing will in this case set the non by variables to null after the first merging record."
Thanks
It was just a another word for djag and proc in your specific example. Call missing has generally nothing to do with BY.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.