home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / bit / listserv / sasl / 3753 < prev    next >
Encoding:
Text File  |  1992-08-17  |  3.3 KB  |  84 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!paladin.american.edu!auvm!DMRHRZ11.BITNET!SCHICK
  3. Message-ID: <SAS-L%92081717365839@AWIIMC12.IMC.UNIVIE.AC.AT>
  4. Newsgroups: bit.listserv.sas-l
  5. Date:         Mon, 17 Aug 1992 16:25:40 CET
  6. Reply-To:     Arnold Schick <SCHICK@DMRHRZ11.BITNET>
  7. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  8. From:         Arnold Schick <SCHICK@DMRHRZ11.BITNET>
  9. Subject:      Re: Subsetting
  10. In-Reply-To:  Your message of Fri, 14 Aug 1992 09:31:19 EDT
  11. Lines: 71
  12.  
  13. On Fri, 14 Aug 1992 09:31:19 EDT Howard Schreier said:
  14. >
  15. >CONTENT:  Correction/Response
  16. >SUMMARY:  Use selective INPUT to subset variables.
  17. >
  18. >> > I need to read a portable sas data file and save it to a SAS DATA
  19. >> > FILE. This is a huge file.  I actually need 1/4 of the variables
  20. >> > only. How can I save this subset of data file in this step?
  21. >
  22. >> With the WHERE clause within a SAS datastep read SAS only those values
  23. >> into that variables, which are named in this statement.
  24. >>
  25. >> i.e.    filename file_in 'see operation.dependent:filename\convention';
  26. >>         data one;
  27. >>           where v_nam_01 v_nam_03 v_nam_09-v_nam29 v_nam34-v_nam43 ;
  28. >>           infile file_in;
  29. >>           input v_nam_01-v_nam99 ;
  30. >>         run;
  31. >
  32. >I'm afraid that this is wrong in at least three  ways.   (1)
  33. >Situation:  the WHERE statement is usable when the DATA step
  34. >is reading SAS data sets rather than  external  files.   (2)
  35. >Purpose:  the WHERE statement is for subsetting observations
  36. >rather than variables.  (3) Syntax:  the word  "WHERE"  must
  37. >be followed by an expression rather than a variable list.
  38. >
  39. >Like the person who posted the earlier  response,  I  assume
  40. >that  "portable  sas  data file" means an external (non-SAS)
  41. >file.  If instead it means a SAS data set in transport form,
  42. >the following is not appropriate.
  43. >
  44. >To subset variables when reading a huge external  file,  the
  45. >best  and most straightforward technique is to construct the
  46. >INPUT statement to selectively read the needed fields  only.
  47. >If  the  file  is  not in fixed format (aligned in columns),
  48. >this is difficult if not impossible.  Otherwise, it is  done
  49. >by  using  either  "column" style or "formatted" style (with
  50. >pointer controls); all of this is described in  the  section
  51. >of the SAS Language manual dealing with the INPUT statement.
  52. >
  53.  
  54. Yes, Howard Schreier is in right.
  55.  
  56. I forgot in the 1th example the 2nd datastep for reducing
  57. the data to the desired variables and, I'm wrong again, it
  58. needs on the WHERE clause/statement an arithmetic/logical
  59. expession, and then are observations selected and not
  60. variables.
  61.  
  62. This 1th example is to correct with an exchange from WHERE
  63. to KEEP statement.
  64.  
  65. In cases of huge files and variable-length is it to reduce by
  66. pre-processing or on INPUT statement as Howard Schreier refe-
  67. red, or to read with dummy variables which are not to keep.
  68. Because it can be the same variable-name, if the last becomes
  69. the value.
  70.  
  71. i.e.             data one;
  72.                     input a b c c d;
  73.                     cards;
  74.                  1  2  3  4  5
  75.                  1  2 3    4 5
  76.                  1 2    3 4    5
  77.                  ;
  78.  
  79. Whereas character values within the data complicates sub-
  80. setting of variables from a huge external file by this
  81. method, also on missings values.
  82.  
  83. Arnold Schick  University of Marburg/Germany
  84.