DATA Step, Macro, Functions and more

How to find the encoding type of a .xpt file

Reply
New Contributor
Posts: 4

How to find the encoding type of a .xpt file

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.

Regular Contributor
Posts: 161

Re: How to find the encoding type of a .xpt file

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.

New Contributor
Posts: 4

Re: How to find the encoding type of a .xpt file

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

Regular Contributor
Posts: 161

Re: How to find the encoding type of a .xpt file

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.

 

Ask a Question
Discussion stats
  • 3 replies
  • 367 views
  • 0 likes
  • 2 in conversation