- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to import excel file in .xls format to SAS using code:
PROC IMPORT out=WORK.test
DATAFILE='/place/where/file.xls'
DBMS=xls REPLACE;
sheet='name';
getnames=YES;
mixed=no;
RUN;
I need to use encoding='UTF-8' to replace some symbols in different columns.
How should I write this code to get right result?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
filename x '/place/where/file.xls' encoding='utf-8'; PROC IMPORT out=WORK.test DATAFILE=x DBMS=xls REPLACE; sheet='name'; getnames=YES; mixed=no; RUN;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, but it doesn't work. Symbols like � stay.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Then Save this xls file into CSV file . and try import again .
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@J_J_J wrote:
Thanks, but it doesn't work. Symbols like � stay.
Interesting. When importing text-files that contain unicode-chars which aren't in the active session encoding (Latin1 on our server), sas writes an error/warning to the log and removes the char from the string. I am wondering why sas inserts fancy chars when reading an excel file containing unicode chars.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Oh. I just be ware of that you need change your sas session into UTF-8 encoding as well to make � appeared.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I had similar issues when retrieving data from external origin into SAS_UE, though it is predefined with encoding='utf-8' .
I found that enlarging LENGTH of specific variables was the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks to everybody. None of the proposed options unfortunately helped. The problem was solved only by changing the format of the file from .xls to .xlsx, fortunately it was possible.