home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / bit / listserv / sasl / 3492 < prev    next >
Encoding:
Text File  |  1992-07-30  |  2.5 KB  |  103 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!gatech!paladin.american.edu!auvm!STACC.MED.UTAH.EDU!KNECHOD
  3. Mailer: Elm [revision: 66.33]
  4. Message-ID: <SAS-L%92073011125730@UGA.CC.UGA.EDU>
  5. Newsgroups: bit.listserv.sas-l
  6. Date:         Thu, 30 Jul 1992 09:16:03 MDT
  7. Reply-To:     knechod@stacc.med.utah.edu
  8. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  9. From:         Kevin Nechodom <knechod@STACC.MED.UTAH.EDU>
  10. Subject:      Re: Comma delimited output file from SAS on MVS/ESA
  11. Comments: To: SAS Mailing List <sas-l@uga.cc.uga.edu>
  12. In-Reply-To:  <01GMZHN6UYR8000AAR@msvax.mssm.edu>; from "TOM ABERNATHY" at Jul
  13.               30, 92 9:55 am
  14. Lines: 87
  15.  
  16. After my earlier post, Tom Abernathy told me:
  17. >
  18. > If you are reaching a limit of 254 for your lines it is probably some
  19. > sort of LRECL default. Try specifying a LRECL on your FILENAME statement.
  20. >
  21. > Good Luck.
  22. > Tom Abernathy
  23. > tom@msvax.mssm.edu
  24. >
  25.  
  26. I did so, and the need for my earlier qualification has disappeared.  Also,
  27. my sample usage of the %COMMA macro had an error in it.  The output filename
  28. must be in quotes.  So here is the revised macro, if anyone wants it.
  29.  
  30. My thanks to Karen Patterson, Ben Connor, and Tom Abernathy.
  31.  
  32. ---- cut here ----
  33. %MACRO comma(lib,file,output);
  34.  
  35. filename SASOUT &output lrecl=4096 recfm=v;
  36. options dquote nomprint nomlogic nomacrogen nosymbolgen
  37.   missing = ' ';
  38.  
  39. title;
  40.  
  41. %let THEPUT=PUT;
  42. %let HDRPUT=PUT;
  43.  
  44. proc contents data=&lib..&file out=filedef noprint;
  45. proc sort;
  46.   by varnum;
  47.  
  48. data _NULL_;
  49.   set filedef;
  50.  
  51. call symput('NVAR',put(varnum,3.));
  52.  
  53. call symput('VNAME'||left(put(_N_,3.)),put(name,$8.));
  54.  
  55. if type = 1 then
  56.   do;
  57.     if format="MMDDYY" then
  58.       call symput('TYPE'||left(put(_N_,3.)),put("D",$1.));
  59.     else
  60.       call symput('TYPE'||left(put(_N_,3.)),put("N",$1.));
  61.   end;
  62. else
  63. if type=2 then
  64.   do;
  65.     call symput('TYPE'||left(put(_N_,3.)),put("C",$1.));
  66.   end;
  67.  
  68. run;
  69.  
  70. data _NULL_;
  71.  
  72. set &lib..&file;
  73. file SASOUT;
  74.  
  75. p = -1;
  76.  
  77. if _N_ = 1 then
  78.   do;
  79.     %do i=1 %to &nvar;
  80.       %let HDRPUT = &HDRPUT '"' "&&VNAME&I" '"' ',';
  81.       %if "&&TYPE&I" = "D" or "&&TYPE&I"="C" %then
  82.         %let THEPUT = &THEPUT '"' &&VNAME&I+P '"' ',';
  83.       %else
  84.         %let THEPUT = &THEPUT &&VNAME&I + P ',';
  85.   %END;
  86. &HDRPUT;
  87. end;
  88.  
  89. &THEPUT;
  90.  
  91. run;
  92.  
  93. %MEND comma;
  94.  
  95. %comma(prod,airheum,'aiout')
  96. ---- cut here ----
  97.  
  98. --
  99. Kevin Nechodom UofU STACC        | Great Moments in Physics History:
  100.  UofU doesn't even know I exist; | "E= m c cubed?  No, too gaudy.
  101.  how would they care what I say? |  E= m c ?  No, too simple.
  102. knechod@stacc.med.utah.edu       |  E= m c squared?  Ah, ha!"
  103.