*
; /* Subject: Re: CSV File Date: Mon, 24 Nov 1997 09:14:39 -0500 From: Prasad Ravi;Newsgroups: comp.soft-sys.sas >Does anyone now of a macro to create a Comma Separated Variable file? I >have one that does something like this but wont put in commas. Here is the macro you are looking for. Prasad Ravi. Example: data one; do x=1 to 10 ; k=x-1; output; end; run; %CSVT(LIB=WORK,DSN=one,FILE=C:\TEMP\one.csv); */ ***options symbolgen macrogen source ; %macro CSVT(lib=,dsn=,file=); %let lib=%upcase(&lib); %let dsn=%upcase(&dsn); proc sql; create view temp as select * from dictionary.columns where libname = "&lib" and memname = "&dsn"; data _null_; set temp end=last ; call symput ('var'||left(put(_n_,3.)),name); if last then call symput('numvar',_n_) ; run ; data _null_; set &lib..&dsn; file "&file" lrecl=10000; if _n_ = 1 then do ; put %do j = 1 %to &numvar; '"' "&&var&j" '",' %end ; ; end ; put %do i = 1 %to &numvar; '"' &&var&i '",' %end ; ; run ; %mend ; *