06-17-2013 11:16 AM
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!!!!!
input person diag ;
data proc ;
input person proc;
data want ;
merge diag proc;
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
06-17-2013 11:24 AM
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!
06-17-2013 11:33 AM
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?????
Need further help from the community? Please ask a new question.