Hi:
Here's what I don't understand...you seem to be mixing a DATA step with an ODS CSV step...you don't need both...since your DATA step is writing to a WORK library, I'm figuring you don't use WORK.OUTCSV2 at all. Here's what you have (***** are my divider lines/comments on your posted code):
[pre]
***** creating a WORK data set here??? why??? ;
DATA OUTCSV2;
SET DEALER_DETAILS2;
***** FILENAME is a global statement. It takes effect as soon as it is encountered ;
***** and stays in effect until you end your session or change or clear the ;
***** filename statement. For this reason, you usually find GLOBAL ;
***** statements OUTSIDE a DATA step program boundary.;
FILENAME CSVOUT2 'B23.D075.ODS(CSV2)'
DSNTYPE=LIBRARY DSORG=PO
DISP=(SHR,CATLG,DELETE);
**** OK, here you start the creation of CSV output and write it to your PDS;
ODS CSV FILE=CSVOUT2 STYLE=NEWSTYLE2 TRANTAB=ASCII;
****** PROC PRINT will be step boundary for DATA OUTCSV2 step ;
PROC PRINT DATA=DEALER_DETAILS2 NOOBS LABEL;
VAR DIAL DLRNUM SAPACC TWN PDEALERN PNAME PHONE_NUM;
LABEL DIAL='00'x DLRNUM='00'x SAPACC='00'x TWN='00'x PDEALERN='00'x
PNAME='00'x PHONE_NUM='00'x;
TITLE 'DEALERSHIP DETAILS';
RUN;
ODS CSV CLOSE;
ODS LISTING; [/pre]
Here's how you could simplify it and not have headers -- using '00'x is a good trick, but PROC REPORT has an option that lets you suppress headers completely:
[pre]
** only need FILENAME statement. Do not need DATA step;
** use FILENAME to point to your PDS member;
FILENAME CSVOUT2 'B23.D075.ODS(CSV2)'
DSNTYPE=LIBRARY DSORG=PO
DISP=(SHR,CATLG,DELETE);
** style not used for ODS CSV;
** add rs=none just in case you find the CSV lines wrapping funny after;
** you FTP -- RS=NONE tells ODS to write out 1 line of output at a time;
ODS CSV FILE=CSVOUT2 TRANTAB=ASCII rs=none;
PROC REPORT DATA=DEALER_DETAILS2 NOWD NOHEADER;
COLUMN DIAL DLRNUM SAPACC TWN PDEALERN PNAME PHONE_NUM;
TITLE 'DEALERSHIP DETAILS';
RUN;
ODS CSV CLOSE;
[/pre]
If you REALLY want a DATA SET from the job, then do this:
[pre]
** this is a made up name for a SAS library;
libname PERMLIB 'B23.D075.PERMSAS' DISP=OLD;
DATA PERMLIB.OUTCSV2;
SET DEALER_DETAILS2;
RUN:
[/pre]
If you want to see the titles in the CSV file, then do this:
[pre]
ODS CSVALL FILE=CSVOUT2 TRANTAB=ASCII rs=none;
(your code)
ODS CSVALL CLOSE;
[/pre]
Or, you could write to the file directly with a data step. Or you could use the
%DS2CSV macro or you could use the %FLATFILE macro:
http://ftp.sas.com/techsup/download/misc/flatfile.pdf
http://support.sas.com/kb/26/085.html
http://www2.sas.com/proceedings/sugi27/p174-27.pdf
cynthia