home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / bit / listserv / sasl / 3876 < prev    next >
Encoding:
Text File  |  1992-08-25  |  2.8 KB  |  86 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!gatech!paladin.american.edu!auvm!SNYONEVA.BITNET!STROTHHM
  3. X-Organization: from SUNY College at Oneonta, NY 13820
  4. X-Envelope-to: sas-l@uga.BITNET
  5. X-VMS-To: IN%"sas-l@uga"
  6. X-VMS-Cc: STROTHHM
  7. Message-ID: <01GO05TZQRAO8WWF2S@SNYONEVA.BITNET>
  8. Newsgroups: bit.listserv.sas-l
  9. Date:         Tue, 25 Aug 1992 15:56:00 EDT
  10. Reply-To:     Helen Strother <STROTHHM@SNYONEVA.BITNET>
  11. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  12. From:         Helen Strother <STROTHHM@SNYONEVA.BITNET>
  13. Subject:      Complicated data step
  14. Lines: 70
  15.  
  16. Hi all,
  17.  
  18.         I have the following data step which creates a data set of all possible
  19. combinations of 5 variables.  What I need to be able to do now is to add some
  20. if statements or whatever else will work depending on whether a person wants to
  21. create the data set with all possible combinations of either 2, 3, 4, or 5
  22. variables.  Through another macro I have collected how many variables they need
  23. to use in a macro variable called nci.  I also have figured out how to choose
  24. which variables to work with.  But to simplify I am not going to show that
  25. here.  Here is the data step:
  26.  
  27. data convert.matrix(keep= resp1 resp2 resp3 resp4 resp5);
  28.    point=1;
  29.    set convert.subtest (rename=(posans=pa1))
  30.    point=point;
  31.    point=2;
  32.    set convert.subtest (rename=(posans=pa2))
  33.    point=point;
  34.    point=3;
  35.    set convert.subtest (rename=(posans=pa3))
  36.    point=point;
  37.    point=4;
  38.    set convert.subtest (rename=(posans=pa4))
  39.    point=point;
  40.    point=5;
  41.    set convert.subtest (rename=(posans=pa5))
  42.    point=point;
  43.    do i = 1 to length(pa1) by 3;
  44.       do j = 1 to length(pa2) by 3;
  45.          do k = 1 to length(pa3) by 3;
  46.             do l = 1 to length(pa4) by 3;
  47.                do m = 1 to length(pa5) by 3;
  48.                  resp1 = substr(pa1,i,3);
  49.                  resp2 = substr(pa2,j,3);
  50.                  resp3 = substr(pa3,k,3);
  51.                  resp4 = substr(pa4,l,3);
  52.                  resp5 = substr(pa5,m,3);
  53.                  output;
  54.                end;
  55.             end;
  56.          end;
  57.       end;
  58.    end;
  59.    stop;
  60. run;
  61.  
  62. The data set convert.subtest looks something like this:
  63.  
  64.   VAR                   POSANS
  65.   0005                  001002003005007008010012
  66.   0007                  002004006008009015
  67.  
  68. Posans is the possible answers to the variable which is the value of VAR, all
  69. put together in a string.  Each individual answer is 3 digits.
  70.  
  71. I would like convert.matrix to look like:
  72.  
  73. RESP1   RESP2   RESP3   RESP4   RESP5
  74. 001     002     002     005     008
  75. 001     002     002     005     009
  76. 001     002     002     005     010
  77.  
  78. and so on.
  79.  
  80.  
  81. Any ideas?  The nesting of conditional statements is making me pull my hair
  82. out!!!  As always, thanks in advance.  Maybe someday I'll be able to answer a
  83. question instead always asking.
  84.  
  85.                 Helen Strother STROTHHM@SNYONEVA
  86.