02-21-2012 12:28 PM
I am faced with two challenges in creating ODS output with SAS 9.3. I am creating a mail merge data file with an ID column, then 6 additional columns with messages. Everyone will have at least one message and some will have more than one up to the six, meaning lots of empty cells all around. Some messages contain over 1024 characters. The ID cell can have up to two leading zeroes.
I have tried to create a modified csv tagset to deal with leading zeroes and that seems to work in a very simple query, but when I assign the adjusted templace to the ODC CSV process, the output is garbage. Quotes start appearing in multiple columns and many columns are shifted.
If I use the plain ods csv process and add an options (quoted_columns='1'), then my column layout looks great, but I don't see leading zeroes appearing on IDs in that first column. Trying to add this quoted_columns option to the modified tagset causes a crash. I might not be adding it correctly, though.
I can't use ODS EXCELXP because of the 1024 character limitation.
Any ideas are appreciated. Thanks!
02-21-2012 12:36 PM
Why are you using ODS to generate a CSV file? Why not just use a data step. Use the Z format to preserve the leading zeros.
Check out this very recent thread on SAS-L.
02-21-2012 12:50 PM
I can overcome the challenges using proc export on my Windows desktop, yes. I have been running this successfully at my desk. I am trying to set this up to run in batch. I thought I had to use ODS for this, but maybe I could use proc export with the sas exprt -noterminal command?
02-21-2012 12:39 PM
Won't a straight CSV export of the data work? Any reason for an ODS?
The leading zero get dropped if you open the CSV file in Excel, but not in the actual CSV file, depending on your output.
This will export a comma quoted file which should meet most requirements for a mail merge data file:
(Data Null's code originall)
file log dsd;
if _n_ eq 1 then link names;
length _name_ $32;
if upcase(_name_) eq '_NAME_' then leave;
put _name_ ~ @;