The SAS Output Delivery System and reporting techniques

ODS CSVALL - values in quotation marks

Reply
Contributor
Posts: 39

ODS CSVALL - values in quotation marks

Hello, is there an option that allows me to remove the quotation marks that all values (characters AND integers) are enclosed in when exporting to ODS CSVALL via proc print? I've looked everywhere and all I found were programs that users can run after the file has already been created. These programs remove the quotation marks. However, I'd prefer an option. Thanks! Phil

Super User
Posts: 10,500

Re: ODS CSVALL - values in quotation marks

Proc export may help but for comma delimited data you usually want quotes around values that contain commas as part of the text or if you are using comma formats for numeric values.

If you really want no quotes at all another approach is a data _null_ step with a file output and put statements.

If you post a short example of source data and example output we might be able to suggest some other options.

Super User
Super User
Posts: 6,500

Re: ODS CSVALL - values in quotation marks

Why use ODSCSV?  Why not just write the CSV file using a DATA step?

Try this code based on idea from data_null_ of using CALL VNEXT to get the variable names.

filename xx temp;

%let dsn=sashelp.class;

%let filen=xx;

*----------------------------------------------------------------------;

* Convert SAS dataset to CSV file ;

*----------------------------------------------------------------------;

options nofmterr ;

data _null_;

  set &dsn ;

  file &filen dsd dlm=',' lrecl=1000000 ;

  if _n_ eq 1 then link names;

  put (_all_) (Smiley Happy;

return;

names:

  length _n_a_m_e_ $200;

  do while(1);

    call vnext(_n_a_m_e_);

    if lowcase(_n_a_m_e_) eq '_n_a_m_e_' then leave;

    _n_a_m_e_=vlabelx(_n_a_m_e_);

    put _n_a_m_e_ @;

  end;

  put;

  return;

run;

data _null_;

infile xx;

input;

put _infile_;

run;


Name,Sex,Age,Height,Weight

Alfred,M,14,69,112.5

Alice,F,13,56.5,84

Barbara,F,13,65.3,98

Carol,F,14,62.8,102.5

Henry,M,14,63.5,102.5

James,M,12,57.3,83

Jane,F,12,59.8,84.5

Janet,F,15,62.5,112.5

Jeffrey,M,13,62.5,84

John,M,12,59,99.5

Joyce,F,11,51.3,50.5

Judy,F,14,64.3,90

Louise,F,12,56.3,77

Mary,F,15,66.5,112

Philip,M,16,72,150

Robert,M,12,64.8,128

Ronald,M,15,67,133

Thomas,M,11,57.5,85

William,M,15,66.5,112

NOTE: 20 records were read from the infile XX.


Super User
Posts: 9,681

Re: ODS CSVALL - values in quotation marks

Easy for proc export .

proc export outfile='c:\temp\class.csv' data=sashelp.class dbms=dlm replace;
delimiter=',';
putnames=yes;
run;

Xia Keshan

Message was edited by: xia keshan

SAS Employee
Posts: 88

Re: ODS CSVALL - values in quotation marks

There is no current option to remove the quotes from the output using ODS CSVALL, however, the tagset  can b modified to generate the desired output.

Ask a Question
Discussion stats
  • 4 replies
  • 1226 views
  • 1 like
  • 5 in conversation