home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!paladin.american.edu!auvm!LOBBY.TI.COM!RSNYDER
- X-Mailer: ELM [version 2.2 PL16]
- Message-ID: <9209111647.AA10924@ti.com>
- Newsgroups: bit.listserv.sas-l
- Date: Fri, 11 Sep 1992 11:47:00 CDT
- Reply-To: "R. Snyder" <rsnyder@LOBBY.TI.COM>
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: "R. Snyder" <rsnyder@LOBBY.TI.COM>
- Subject: RE: Lo...ng macro variables
- Comments: To: gibes@SWIRL.MONSANTO.COM
- Comments: cc: sas-l@uga.cc.uga.edu
- In-Reply-To: <9209111543.AA08124@ti.com>; from "Kernon Gibes" at Sep 11,
- 92 10:38 am
- Lines: 83
-
- SUBJECT: Lo..ng Macro Variables
- SUMMARY: Getting past 200 characters
- E-ADDR: rsnyder@lobby.ti.com
- NAME: Bob Snyder
- COMPANY: Texas Instruments, Sherman, TX
- PHONE: (903) 868-5799
- FAX: (903) 868-7240
- >
- > 2) No, Bob's code does not work fine. Try testing it on the ACTUAL
- > situation; that is, where POSSANS has length of 200 characters.
- > (Or, say, two records of 150 each). Perry's test case does work,
- > but it wasn't what Helen was dealing with. For example, see the
- > extension of Perry's code below where we finally get truncation.
- >
- > 3) Bob's code didn't include a COMPRESS, which was my second point.
- > However, this doesn't solve all the problems because the character
- > string expression in the second argument of SYMPUT is, I believe,
- > subject to the 200 byte limit imposed on data set character
- > variables [ hopefully, I have this limit correct? ;-) ]
- >
- > Kernon Gibes
- >
- The test code below addresses the 200 character limit on the expression
- symget('mvar')||... .
-
- As for point 3, my intent was to suggest a method of concatenating macro
- variables in a data step. I was not trying to write the whole program.
-
- Regards,
- Bob
-
- /* ------------------- Test Code -------------------- */
-
- %macro concat;
-
- %do i = 1 %to &vars;
- %let mvar = &mvar%str( )&&mvar&i;
- %end;
-
- %mend concat;
-
- Data temp;
- Input varnum $ possans $;
- cards;
- 01 Jack
- 02 and
- 03 Jill
- 04 ran
- 05 up
- 06 the
- 07 hill
- ;
- Run;
-
- data longer;
- set temp temp temp temp temp temp temp temp temp temp temp
- temp temp temp temp temp temp temp temp temp temp temp
- ;
- run;
-
- %let mvar = ;
- Data test;
- set longer;
- Call Symput('vars', left(_n_) );
- Call Symput('mvar'||left(_n_), compress(possans));
- Run;
-
- %concat;
-
- %put &mvar; run;
- /*** end of test code ***/
-
- The result:
-
- Jack and Jill ran up the hill Jack and Jill ran up the hill Jack and Jill
- ran up the hill Jack and Jill ran up the hill Jack and Jill ran up the hill
- Jack and Jill ran up the hill Jack and Jill ran up the hill Jack and Jill
- ran up the hill Jack and Jill ran up the hill Jack and Jill ran up the hill
- Jack and Jill ran up the hill Jack and Jill ran up the hill Jack and Jill
- ran up the hill Jack and Jill ran up the hill Jack and Jill ran up the hill
- Jack and Jill ran up the hill Jack and Jill ran up the hill Jack and Jill
- ran up the hill Jack and Jill ran up the hill Jack and Jill ran up the hill
- Jack and Jill ran up the hill Jack and Jill ran up the hill
-