BookmarkSubscribeRSS Feed
Sandyz
Fluorite | Level 6

Hi All,

 

I have requirement to find the encoding type of a .xpt file, if i use libname+xport engine i am getting encoding type as"Default" but thats not the actual encoding.

 

If i use libname+xport engine+proc copy getting the encoding type of sas environment, means irrespective filetype, getting default sas encoding type.(i.e. UTF-8).

 

Please let me know, is there any way or X commands to find the encoding type.

4 REPLIES 4
paulkaefer
Lapis Lazuli | Level 10

X commands are UNIX commands, so according to this StackOverflow post,

file -bi <file name>

should do the trick.

 

This page says you can specify encoding="utf-8" when creating the set.

 

This page says you can determine encoding from within SAS by right-clicking and selecting properties.

Sandyz
Fluorite | Level 6

Hi  paulkaefer,

 

Thaks for your reply, i tried unix command in sas session howevr it's not working. Can you tell me any other way to do it.

 

 

Thanks,

Sandeep

paulkaefer
Lapis Lazuli | Level 10

The first thing to check is, are you actually running on a Linux/UNIX environment? If so, what is the log saying? It's difficult to diagnose the problem just based on you saying it's not working for you. Is there a chance it's looking in the wrong directory? Perhaps there is a problem with the command or program logic.

 

If you are running on Windows, you'll probably have a problem. The X statement will still work under Windows, but the file command is not available by default. You could install coreutils or Cygwin to get it on Windows.

 

XunjieLi
Calcite | Level 5

Dear,

 

Would you please let me know if you've figured out the question about the xpt encoding?

 

Looking forward to the responses.

 

Regards,

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 3330 views
  • 1 like
  • 3 in conversation