Excel read the cell verbatim

Reply
Frequent Contributor
Posts: 83

Excel read the cell verbatim


How can I read the values of the cells and preserve their value verbatim.  For instance, the value might be ≥65 years and via DDE and INFILE the value in ?65 in SAS.  It seems like this is a encoding issue (Western European).

Thank you,

Kevin

Trusted Advisor
Posts: 3,215

Re: Excel read the cell verbatim

Posted in reply to KevinViel

DDE has been declared death many times as it is a keyboard interaction way of one of the first excel releases.  The excel way of storage has changed a lot.

See https://communities.sas.com/message/216638#216638


Today most pc's are using utf8 by default the Latin1 approach is the way you and many others are still thinking.

Indeed an encoding issue.


SAS is by default used in Latin1 with some country setting. You could use a utf8 SAS session.

---->-- ja karman --<-----
Frequent Contributor
Posts: 83

Re: Excel read the cell verbatim

Jaap,

  Indeed, as stated in the link you provided and something about which you are undoubtedly more expert, more modern Excel (and other MS Office files) files are XLM files as indicated by the X at the end of the extension: .xlsm.

  I am not convinced DDE is dead (see the question in my reply to the responses in the link).  You are correct about the encoding.  I would further suggest, without testing or confidence that it is correct or feasible, that one may not need a particular encoding session:

data specs ( encoding = "utf-8" ) ;

  infile XL

           DSD

           Pad

           DLM = "09"x

           encoding = "utf-8"

            ;

  length col1 - col3 $ 100 ;

  input col1 - col3 ;

run ;

As suggested by Joe Matisse on SAS-L: LISTSERV 16.0 - SAS-L Archives

I appreciate your help,

Kevin

Trusted Advisor
Posts: 3,215

Re: Excel read the cell verbatim

Posted in reply to KevinViel

Kevin, the link you found correctly is referring to the start script of sas in a utf8 session mode instead of the often used en Latin1 one.

Creating a sas dataset by default uses the sas session encoding setting. Utf8 is very popular as most of the single byte chars are the Latin1 alikes. Reading of utf8 files normally goes not noticed but as Latin1 is a very small subset of utf8 you will have a lot of mismatches. These mismatches get marked.

The nls is something to get traumatized, the doc is at

https://support.sas.com/documentation/cdl/en/nlsref/67110/HTML/default/viewer.htm#titlepage.htm

---->-- ja karman --<-----
Ask a Question
Discussion stats
  • 3 replies
  • 310 views
  • 3 likes
  • 2 in conversation