BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Cruise
Ammonite | Level 13

Hi Folks:

I'd like to use English in writing SAS programs. But I have about 10 excel datasets sorted on the ID variables that are written in Korean characteristics. I'd like to merge these 10 data sets by ID in Korean characteristics. After merging, I'll have to proc export the resulting merged dataset into excel keeping ID in Korean characteristics.  

I found u8 folder in my SASFoundation folder. 

 

Can you please help what needed to be done from here? I find SAS documentation on the topic complex. One of excel sheets that I'm trying to import and export is attached for example.

 

language.png

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

If they setup your laptop right in addition to a command to launch SAS using single byte encoding you should have one to launch using 
unicode support.  Just start SAS with than icon/command.

Tom_0-1587940636156.png

 

View solution in original post

10 REPLIES 10
Cruise
Ammonite | Level 13

I'm not allowed to change nls/en to nls/u8 in the SASFoundation. This is my personal laptop but still not allowed to make changes. Maybe I should try linking the tables in Excel. 

 

can't change.png

SASKiwi
PROC Star

Did you try Administrator mode for Notepad++? You should have administrator access to your own personal laptop.

Cruise
Ammonite | Level 13

@SASKiwi 

Yes, I was able to change in the notepad+++. ThenI tried following based on SAS help center's blog with no success. Resulting test dataset has nonsensical symbols instead Korean characteristics.

FILENAME IN "D:\mydata.txt" Encoding="utf-16";
       PROC IMPORT OUT= WORK.test
       DATAFILE= IN
       DBMS=TAB REPLACE;
       GETNAMES=YES;
       DATAROW=2;
       RUN;

	   proc options option=encoding; run;

proc options option=encoding; run;

SAS (r) Proprietary Software Release 9.4  TS1M5
 ENCODING=WLATIN1
Tom
Super User Tom
Super User

If they setup your laptop right in addition to a command to launch SAS using single byte encoding you should have one to launch using 
unicode support.  Just start SAS with than icon/command.

Tom_0-1587940636156.png

 

Cruise
Ammonite | Level 13

@Tom 

This is what i see. It seems that all I have is SAS with DBCS. Opening 'SAS with DBCS' version help? 

 

my system.png

Cruise
Ammonite | Level 13

@Tom 

Yay, I found one with unicode support. Can you show me in SAS code how to import the file that I attached to this post for example? Given that I now have opened Unicode Support SAS, please?

 

found it.png

Cruise
Ammonite | Level 13

@Tom this worked. I can't believe my eyes!!!! Thank you so much. I struggled whole 5 hours. The problem was solved in just couple minutes. Thank you. 

 

FILENAME IN "camp1.txt";
       PROC IMPORT OUT= WORK.test
       DATAFILE= IN
       DBMS=TAB REPLACE;
       GETNAMES=YES;
       DATAROW=2;
       RUN;

worked.png

Tom
Super User Tom
Super User
Glad it worked, but that code would NOT work with the file you originally posted. That files was an XLSX file, not a tab delimited text file your code is reading.
Cruise
Ammonite | Level 13

@Tom 

Yes, you're right. It didn't work with .xlsx datasets that I actually have unless I open them one by one and save to unicode.txt. I tried the code below which created non-sensical dataset. Any suggestion as to how to make/modify this code to work for .xlsx files? 

PROC IMPORT OUT=test_excel
DATAFILE="camp.xlsx"
DBMS=TAB REPLACE;
GETNAMES=YES;
DATAROW=2;
RUN;

 gyber jabber.png

Tom
Super User Tom
Super User

I am sure that is a good representation of what it would like if you read the binary XLSX file as if it was a text file.

You need to tell PROC IMPORT to use the XLSX engine.

proc import dbms=xlsx datafile="&path\&fname"
  out=test replace 
;
run;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 10 replies
  • 1996 views
  • 3 likes
  • 3 in conversation