home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / bit / listserv / sasl / 3437 < prev    next >
Encoding:
Text File  |  1992-07-27  |  2.0 KB  |  75 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!paladin.american.edu!auvm!STACC.MED.UTAH.EDU!KNECHOD
  3. Mailer: Elm [revision: 66.33]
  4. Message-ID: <SAS-L%92072716125509@UGA.CC.UGA.EDU>
  5. Newsgroups: bit.listserv.sas-l
  6. Date:         Mon, 27 Jul 1992 14:15:40 MDT
  7. Reply-To:     knechod@stacc.med.utah.edu
  8. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  9. From:         Kevin Nechodom <knechod@STACC.MED.UTAH.EDU>
  10. Subject:      Date Selection with Data Steps
  11. Comments: To: SAS Mailing List <sas-l@uga.cc.uga.edu>
  12. Lines: 61
  13.  
  14. I am trying to write a data step script that will select a subset of
  15. records out of a data set that has each record dated.
  16.  
  17. Data Set
  18. --------
  19.   Date
  20. Received   Data ...
  21. 02/03/92   ....
  22. 05/04/92   ....
  23. 03/29/91   ....
  24.  
  25. I would like to make it easy for whoever uses this script to change
  26. the cutoff date.
  27.  
  28. 1. I think I can put the date into a data step that puts the date
  29.    into its own data set.  Then merge that date with my actual data
  30.    into a temp data set.  Then use a WHERE clause to select out the
  31.    appropriate records.
  32.  
  33. Data tempdate;
  34.   input cutoff mmddyy8.;
  35.   cards;
  36. 04/15/92
  37. ;
  38. data workmrge;
  39.   .
  40.   .
  41.   .
  42.  
  43. 2. Another approach which I used in an emergency was to use the
  44.    DATEJUL function.
  45.  
  46. data work.junk;
  47.   length cutoff 4;
  48.   cutoff = datejul(92185); /* I do NOT like this!  It's not simple! */
  49.   set prod.airheum;
  50.   ;
  51. run;
  52. data WORK.FREQ;
  53.    set work.junk;
  54.    where recdate <= cutoff;
  55.    .
  56.    .
  57.    .
  58.  
  59.  
  60. I would like to avoid writing intermediate data sets and calculating
  61. days-of-the-year.  Is there anything like the SCL INPUTN function that
  62. returns:
  63.  
  64.   cutoff = INPUTN("04/15/92","mmddyy8.");
  65.  
  66. that I could use within the data step and a WHERE clause?
  67.  
  68. Prethanks for the mental bandwidth.
  69.  
  70. --
  71. Kevin Nechodom UofU STACC        | Great Moments in Physics History:
  72.  UofU doesn't even know I exist; | "E= m c cubed?  No, too gaudy.
  73.  how would they care what I say? |  E= m c ?  No, too simple.
  74. knechod@stacc.med.utah.edu       |  E= m c squared?  Ah, ha!"
  75.