Date: Thu, 13 Sep 2007 13:20:39 -0400
Reply-To: Mike Rhoads <RHOADSM1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mike Rhoads <RHOADSM1@WESTAT.COM>
Subject: Re: ODS CSV files
In-Reply-To: <20070913095048.AB27.JWD@uga.edu>
Content-Type: text/plain; charset="us-ascii"
Bad news and good news.
The bad news -- I just looked at the latest version of the CSV tagset,
and I don't see an option to suppress the double quotes.
The good news -- this is your opportunity to get into the wonderful
world of tagset editing. Take a look at one or more of Eric Gebhart's
papers, such as "The Beginners Guide to ODS MARKUP: Don't Panic!" (at
http://support.sas.com/rnd/base/topics/odsmarkup/p236-31.pdf). This
paper specifically discusses the CSV tagset, among others.
CAUTION #1 -- I am by no means an expert on this, but I believe this
will work.
This can be somewhat arcane, and many of the tagsets are quite
complicated. Fortunately, CSV is one of the simplest, and the change
you would need to make is also simple. There are a couple of places
within the latest version of ODS CSV that look like:
do /if cmp($type, "String");
put '"';
done;
Basically, "If this value is a string, put out a double quote." There's
one of these before and after the value itself is written.
So, just remove both of these, give the tagset a different name
(CSVNOQUOT, perhaps), and run PROC TEMPLATE. You will then need to use
ODS TAGSETS.CSVNOQUOT in your jobs to reference it.
CAUTION #2 -- You will get into trouble if you use this new tagset with
character string values that contain embedded commas.
Good luck!
Mike Rhoads
Westat
RhoadsM1@Westat.com
-----Original Message-----
From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu]
On Behalf Of Jerry Davis
Sent: Thursday, September 13, 2007 9:52 AM
To: sas-l@listserv.uga.edu
Subject: ODS CSV files
As part of a class assignment, I am having students create a CSV file
using ODS statements. The resulting file has double quotes surrounding
the character data within the comma delimiters. Excel has no problems
reading a CSV fle structured this way so it is an acceptable method of
transferring data.
However, the file looks messy. Is there a style or other option that
will direct ODS to write the file without enclosing character data in
double quotes?
Thanks,
Jerry
--
Jerry Davis
Experimental Statistics
UGA, CAES, Griffin Campus