home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / bit / listserv / sasl / 4162 < prev    next >
Encoding:
Text File  |  1992-09-11  |  3.0 KB  |  100 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!paladin.american.edu!auvm!LOBBY.TI.COM!RSNYDER
  3. X-Mailer: ELM [version 2.2 PL16]
  4. Message-ID: <9209111647.AA10924@ti.com>
  5. Newsgroups: bit.listserv.sas-l
  6. Date:         Fri, 11 Sep 1992 11:47:00 CDT
  7. Reply-To:     "R. Snyder" <rsnyder@LOBBY.TI.COM>
  8. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  9. From:         "R. Snyder" <rsnyder@LOBBY.TI.COM>
  10. Subject:      RE: Lo...ng macro variables
  11. Comments: To: gibes@SWIRL.MONSANTO.COM
  12. Comments: cc: sas-l@uga.cc.uga.edu
  13. In-Reply-To:  <9209111543.AA08124@ti.com>; from "Kernon Gibes" at Sep 11,
  14.               92 10:38 am
  15. Lines: 83
  16.  
  17. SUBJECT:   Lo..ng Macro Variables
  18. SUMMARY:   Getting past 200 characters
  19. E-ADDR:    rsnyder@lobby.ti.com
  20. NAME:      Bob Snyder
  21. COMPANY:   Texas Instruments, Sherman, TX
  22. PHONE:     (903) 868-5799
  23. FAX:       (903) 868-7240
  24. >
  25. > 2) No, Bob's code does not work fine.  Try testing it on the ACTUAL
  26. >    situation; that is, where POSSANS has length of 200 characters.
  27. >    (Or, say, two records of 150 each).  Perry's test case does work,
  28. >    but it wasn't what Helen was dealing with.  For example, see the
  29. >    extension of Perry's code below where we finally get truncation.
  30. >
  31. > 3) Bob's code didn't include a COMPRESS, which was my second point.
  32. >    However, this doesn't solve all the problems because the character
  33. >    string expression in the second argument of SYMPUT is, I believe,
  34. >    subject to the 200 byte limit imposed on data set character
  35. >    variables [ hopefully, I have this limit correct?  ;-) ]
  36. >
  37. > Kernon Gibes
  38. >
  39. The test code below addresses the 200 character limit on the expression
  40. symget('mvar')||... .
  41.  
  42. As for point 3, my intent was to suggest a method of concatenating macro
  43. variables in a data step. I was not trying to write the whole program.
  44.  
  45. Regards,
  46. Bob
  47.  
  48. /* ------------------- Test Code -------------------- */
  49.  
  50. %macro concat;
  51.  
  52.   %do i = 1 %to &vars;
  53.     %let mvar = &mvar%str( )&&mvar&i;
  54.   %end;
  55.  
  56. %mend concat;
  57.  
  58. Data temp;
  59.   Input varnum $ possans $;
  60. cards;
  61. 01 Jack
  62. 02 and
  63. 03 Jill
  64. 04 ran
  65. 05 up
  66. 06 the
  67. 07 hill
  68. ;
  69. Run;
  70.  
  71. data longer;
  72.   set temp temp temp temp temp temp temp temp temp temp temp
  73.       temp temp temp temp temp temp temp temp temp temp temp
  74.   ;
  75. run;
  76.  
  77.   %let mvar = ;
  78. Data test;
  79.   set longer;
  80.     Call Symput('vars', left(_n_) );
  81.     Call Symput('mvar'||left(_n_), compress(possans));
  82. Run;
  83.  
  84. %concat;
  85.  
  86. %put &mvar; run;
  87. /*** end of test code ***/
  88.  
  89. The result:
  90.  
  91.  Jack and Jill ran up the hill Jack and Jill ran up the hill Jack and Jill
  92. ran up the hill Jack and Jill ran up the hill Jack and Jill ran up the hill
  93. Jack and Jill ran up the hill Jack and Jill ran up the hill Jack and Jill
  94. ran up the hill Jack and Jill ran up the hill Jack and Jill ran up the hill
  95. Jack and Jill ran up the hill Jack and Jill ran up the hill Jack and Jill
  96. ran up the hill Jack and Jill ran up the hill Jack and Jill ran up the hill
  97. Jack and Jill ran up the hill Jack and Jill ran up the hill Jack and Jill
  98. ran up the hill Jack and Jill ran up the hill Jack and Jill ran up the hill
  99. Jack and Jill ran up the hill Jack and Jill ran up the hill
  100.