BookmarkSubscribeRSS Feed
PhilfromGermany
Fluorite | Level 6

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

4 REPLIES 4
ballardw
Super User

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.

Tom
Super User Tom
Super User

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_) (:);

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.


Ksharp
Super User

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

Chevell_sas
SAS Employee

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 3869 views
  • 1 like
  • 5 in conversation