home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!gatech!paladin.american.edu!auvm!SNYONEVA.BITNET!STROTHHM
- X-Organization: from SUNY College at Oneonta, NY 13820
- X-Envelope-to: sas-l@uga.BITNET
- X-VMS-To: IN%"sas-l@uga"
- X-VMS-Cc: STROTHHM
- Message-ID: <01GO05TZQRAO8WWF2S@SNYONEVA.BITNET>
- Newsgroups: bit.listserv.sas-l
- Date: Tue, 25 Aug 1992 15:56:00 EDT
- Reply-To: Helen Strother <STROTHHM@SNYONEVA.BITNET>
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: Helen Strother <STROTHHM@SNYONEVA.BITNET>
- Subject: Complicated data step
- Lines: 70
-
- Hi all,
-
- I have the following data step which creates a data set of all possible
- combinations of 5 variables. What I need to be able to do now is to add some
- if statements or whatever else will work depending on whether a person wants to
- create the data set with all possible combinations of either 2, 3, 4, or 5
- variables. Through another macro I have collected how many variables they need
- to use in a macro variable called nci. I also have figured out how to choose
- which variables to work with. But to simplify I am not going to show that
- here. Here is the data step:
-
- data convert.matrix(keep= resp1 resp2 resp3 resp4 resp5);
- point=1;
- set convert.subtest (rename=(posans=pa1))
- point=point;
- point=2;
- set convert.subtest (rename=(posans=pa2))
- point=point;
- point=3;
- set convert.subtest (rename=(posans=pa3))
- point=point;
- point=4;
- set convert.subtest (rename=(posans=pa4))
- point=point;
- point=5;
- set convert.subtest (rename=(posans=pa5))
- point=point;
- do i = 1 to length(pa1) by 3;
- do j = 1 to length(pa2) by 3;
- do k = 1 to length(pa3) by 3;
- do l = 1 to length(pa4) by 3;
- do m = 1 to length(pa5) by 3;
- resp1 = substr(pa1,i,3);
- resp2 = substr(pa2,j,3);
- resp3 = substr(pa3,k,3);
- resp4 = substr(pa4,l,3);
- resp5 = substr(pa5,m,3);
- output;
- end;
- end;
- end;
- end;
- end;
- stop;
- run;
-
- The data set convert.subtest looks something like this:
-
- VAR POSANS
- 0005 001002003005007008010012
- 0007 002004006008009015
-
- Posans is the possible answers to the variable which is the value of VAR, all
- put together in a string. Each individual answer is 3 digits.
-
- I would like convert.matrix to look like:
-
- RESP1 RESP2 RESP3 RESP4 RESP5
- 001 002 002 005 008
- 001 002 002 005 009
- 001 002 002 005 010
-
- and so on.
-
-
- Any ideas? The nesting of conditional statements is making me pull my hair
- out!!! As always, thanks in advance. Maybe someday I'll be able to answer a
- question instead always asking.
-
- Helen Strother STROTHHM@SNYONEVA
-