home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / bit / listserv / sasl / 5517 < prev    next >
Encoding:
Text File  |  1993-01-05  |  1.9 KB  |  55 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!usc!wupost!psuvax1!psuvm!auvm!SWIRL.MONSANTO.COM!GIBES
  3. Message-ID: <9301051939.AA24929@tin.monsanto.com>
  4. Newsgroups: bit.listserv.sas-l
  5. Date:         Tue, 5 Jan 1993 13:39:03 -0600
  6. Reply-To:     Kernon Gibes <gibes@SWIRL.MONSANTO.COM>
  7. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  8. From:         Kernon Gibes <gibes@SWIRL.MONSANTO.COM>
  9. Subject:      RE: Match Merge Problem
  10. Comments: To: SAS-L@uga.cc.uga.edu@tin.monsanto.com
  11. Comments: cc: GIBES@tin.monsanto.com
  12. Lines: 41
  13.  
  14. In reply to a data merging question by Dr. Francis Dane, Ron Fehd wrote,
  15. in part:
  16.  
  17. >well, looks like you may have a problem with your version.
  18.  
  19. and I agree that a straightforward merge should have worked, but in
  20. Ron's single data step solution:
  21.  
  22. >now here's another data build solution with arrays and retain:
  23. >
  24. >DATA PEOPLE;
  25. >  set <something>;
  26. >  by Pt# NCode;
  27. >  retain VarA1 VarA2 ... VarAn
  28. >         VarB1 VarB2 ... VarBn 0;
  29. >  select(NCode);
  30. >    when (1);
  31. >    when (2) do; VarA2 = VarA1;
  32. >                 VarB2 = VarB1;                 end;
  33. >    when (3) do; VarA3 = VarA1;
  34. >                 VarB3 = VarB1;                 end;
  35. >    ...
  36. >    when (N) do; VarAN = VarA1;
  37. >                 VarBN = VarB1;                 end;
  38. >    otherwise;                                  end;
  39. >    if last.NCode then output;
  40.  
  41. It seems to me that the "last.NCode" should probably be a "last.Pt#",
  42. but the larger issue is that this code would appear to propagate the
  43. values of VarA1, VarB1 in an unintended fashion, i.e. yielding:
  44.  
  45.              OBS    PT#    VARA1    VARB1    NCODE    VARA2    VARB2
  46.  
  47.               1     12       85       50       2        85       50
  48.               2     13       70       80       1        85       50
  49.  
  50. I think a more elaborate retain/variable assignment would be required to
  51. fix the single data step solution.
  52.  
  53. Kernon Gibes
  54. Internet: gibes@swirl.monsanto.com
  55.