SAS Enterprise Guide

Desktop productivity for business analysts and programmers
BookmarkSubscribeRSS Feed
ThomasD
Calcite | Level 5

Hello,

I prepare tables in SAS EG 4.3 to later export them to SAS. All variables are character fields.

After exporting, every cell in the excel-file automatically gets preceded by an apostrophe ( ' ).

I strongly suspect this to be problematic when importing that excel-file into another application.

I am not able to change this. Things I tried to undo this:

  • copying the data into another excel
  • lift all kinds of file and cell securities
  • ...

Can someone explain

  • why the apostrophe is there ? To mark a text/character field ?
  • how to remove the apostrophes in every cell ?

Thank you.

Thomas

4 REPLIES 4
Kurt_Bremser
Super User

The leading apostrophe or single quote is used to signify character fields. Welcome to the wonderful world of Excel, and The Folly That Is Thinking That Excel Is Any Good For Business Intelligence.

If you remove the leading single quote, fields with numeric values will be treated as numbers in Excel (leading 0s removed etc).

ThomasD
Calcite | Level 5

Thank you. That answers my first question.

If it were possible, I'd export my SAS table directly into that other application. However, that application only welcomes excel-files.

And the main problem remains: I'm not able to remove the leading single quotes. (Or more accurate: if I remove it, Excel automatically puts it back.)

Kurt_Bremser
Super User

However, that application only welcomes excel-files.


Does that mean only .xls and .xlsx, or anything that is also accepted by excel, like .xml or .csv?

user24feb
Barite | Level 11

I can't offer a perfect fix, but you might either use the trim-function in excel (depends on your data), or export as csv and open with excel or use proc export, or in excel: "data" > "text to columns" > text qualifier = none.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2992 views
  • 0 likes
  • 3 in conversation