home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / bit / listserv / sasl / 5758 < prev    next >
Encoding:
Internet Message Format  |  1993-01-27  |  2.7 KB

  1. Path: sparky!uunet!stanford.edu!bu.edu!olivea!sgigate!sgiblab!swrinde!zaphod.mps.ohio-state.edu!howland.reston.ans.net!paladin.american.edu!auvm!CCM.HF.INTEL.COM!THOMAS_M_SKINNER
  2. From: Thomas_M_Skinner@CCM.HF.INTEL.COM (Thomas M Skinner)
  3. Newsgroups: bit.listserv.sas-l
  4. Subject: Re: Reordering variables in a SAS dataset
  5. Message-ID: <930126091340_4@ccm.hf.intel.com>
  6. Date: 26 Jan 93 17:13:40 GMT
  7. Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  8. Reply-To: Thomas M Skinner <Thomas_M_Skinner@CCM.HF.INTEL.COM>
  9. Lines: 46
  10. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  11. Comments: To: SAS-L@uga.cc.uga.edu
  12.  
  13.  
  14.                                                         Folsom, California
  15.                                                         January 26, 1993
  16.                                                         Sunny, Bit of Frost
  17.  
  18.  
  19. Dear SAS-Lers,
  20.  
  21. Theodore N. Greenstein Writes:
  22.  
  23. >Is there an easy way to reorder the variables in a SAS dataset (this
  24. >is under 6.08 for Windows)?  I know that I can (a) change the order
  25. >write the variables out using a PUT statement, then read them back
  26. >in the desired order.  But isn't there some easier way?
  27. >
  28. >Just for comparison, I notice that SPSS/PC has a command that will do
  29. >exactly this: reorder the variables in any desired ordering.
  30. >
  31.  
  32. The best way I can think of is to simply "declare" the variables in a
  33. length statement in the order you wish.  At the beginning of the data step,
  34. the "program data vector" is set up in memory by first scanning for
  35. non-executable statements (of which length is one), and then the
  36. executables, such as the "set" statement. The non-executable statements are
  37. used to assign slots in the vector, then variables from the input, set,
  38. assignment statements, etc are assigned.  Thus the length statement can be
  39. used on either datasets derived via "input" statements or by set/merge
  40. statements to determing the order of the vsriables in the resulting
  41. dataset.
  42.  
  43. You may also use the "ATTRIB" statement to accomplish the same thing, and
  44. it gives you the ability to assign lables, informats, formats, as well as
  45. lengths.
  46.  
  47. I believe the KEEP statement, and the "KEEP=" option the DATA statement
  48. will accomplish the same thing, without having to specify lengths, etc...
  49. Program efficiency is gained from limiting lengths to specified minimums
  50. however, so using the length statement is desirable from that standpoint.
  51.  
  52. Intel-Insider,
  53. Tom Skinner
  54. ===========================================================================
  55. T.M. Skinner                    Internet: Thomas_M_Skinner@ccm.hf.intel.com
  56. Sr. SAS Tech. Support               Mail: 1900 Prairie City Rd. MS FM1-102
  57. Intel Corporation                         Folsom, CA 95630
  58. ===========================================================================
  59.