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

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!paladin.american.edu!auvm!PHPDLS1.EM.CDC.GOV!RJF2
  3. Encoding: 49 TEXT
  4. X-Mailer: Microsoft Mail V3.0
  5. Message-ID: <2B4BB285@router.em.cdc.gov>
  6. Newsgroups: bit.listserv.sas-l
  7. Date:         Thu, 7 Jan 1993 08:33:00 EST
  8. Reply-To:     rjf2@PHPDLS1.EM.CDC.GOV
  9. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  10. From:         rjf2@PHPDLS1.EM.CDC.GOV
  11. Subject:      discard superfluous observations *HOW*?
  12. Comments: To: SAS-L@uga.cc.uga.edu
  13. Lines: 45
  14.  
  15. content      : Response
  16. summary      : discarding excess obs
  17. rlse/platform: V6.07 / MVS
  18. Ron Fehd     :                SMTP:BitNet:    <rjf2@phpdls1.em.cdc.gov>
  19.               Centers for Disease Control
  20.               1600 Clifton Rd  MS:G25         FAX  : 404/639-1778
  21.               Atlanta, GA 30333  USA          phone: 404/639-1707
  22. ????????????????????????????????????????????????????????????????????????
  23. From:         Patrick Haggard <ph@PHYSIOLOGY.OXFORD.AC.UK>
  24. Subject:      discard superfluous observations *HOW*?
  25. I have some data containing between n and m observations in each
  26. of C conditions.  I would like to have exactly n observations in
  27. each condition, so that my design is balanced: I'm fairly happy that
  28. discarding the excess observations shouldn't change things too much.
  29. My question: can anyone suggest a way to discard the excess
  30. observations in a SAS data step, and to number the remaining
  31. observations 1...n for each condition.
  32. Thanks
  33. --------------------------------------------------------------------------
  34. Patrick Haggard                         Email (WORLD): ph@physiol.ox.ac.uk
  35. University Laboratory of Physiology     Email (JANET): ph@uk.ac.ox.physiol
  36. Parks Road,                             Tel. (0865) 272116
  37. Oxford, OX1 3PT                         Fax. (0865) 272469
  38. England
  39. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  40. ooooooooh, getting rid of extra data!?!?!? what a shame, once you have spent
  41. the money to collect. really good stuff, that data.
  42.  
  43. you'll need a counter and retain statement:
  44.  
  45. %LET HOW_MANY = 3;
  46.  
  47. /*if not SORTED then:*/
  48. proc SORT;
  49.   by ID_Var;
  50.  
  51. DATA OBS_EQ_&HOWMANY.;
  52.   set <something>;
  53.   retain Counter 1;
  54.   by  ID_Var;
  55.   if first.ID_Var then Counter = 1;
  56.   else                 Counter + 1;
  57.   if Counter le &HOW_MANY. then output;
  58.  
  59. endSAS; happy crunching!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!
  60.