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

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!spool.mu.edu!uwm.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!paladin.american.edu!auvm!COMPUSERVE.COM!76350.1604
  3. Message-ID: <930106225402_76350.1604_EHJ101-2@CompuServe.COM>
  4. Newsgroups: bit.listserv.sas-l
  5. Date:         Wed, 6 Jan 1993 17:54:03 EST
  6. Reply-To:     Andy Norton <76350.1604@COMPUSERVE.COM>
  7. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  8. From:         Andy Norton <76350.1604@COMPUSERVE.COM>
  9. Subject:      discard superfluous observations *HOW*?
  10. Comments: To: SAS-L <SAS-L@AWIIMC12.IMC.UNIVIE.AC.AT>
  11. Lines: 29
  12.  
  13. ----------------------------------------------------------------------
  14. CONTENT:   Response
  15. SUMMARY:   Counting within groups
  16. REL/PLTF:  6.07.0304/CMS, 6.04/PC-DOS, beta 6.08/OS2
  17. E-ADDR:    76350.1604@compuserve.com
  18. NAME:      Andy Norton
  19. ADDRESS:   Trilogy Consulting, 5148 Lovers Lane, Kalamazoo MI 49002 USA
  20. PHONE:     (616) 344-4100
  21. ----------------------------------------------------------------------
  22.  
  23. Patrick Haggard asks
  24. > My question: can anyone suggest a way to discard the excess
  25. > observations in a SAS data step, and to number the remaining
  26. > observations 1...n for each condition.
  27.  
  28. proc sort;
  29.   by COND;
  30. run;
  31.  
  32. data REDUCED;
  33.   set;
  34.     by COND;
  35.   if first.COND then
  36.      COUNT=0;
  37.    COUNT+1;
  38.    if COUNT <= &N;
  39. run;
  40.  
  41. Where &N represents the desired number of observations in each cell.
  42.