0
votes

I've got proc import from xlsx file with column names in polish language.

My simple proc looks like this:

proc import datafile = '/directory/file_name.XLSX'

 out  = libname.tablename
 dbms  =  xlsx
 replace;

run;

I would like to add somewhere ENCODING="LATIN2" so the columns don't look like:

enter image description here

Is it possible? And how?

I could do it in second step by renaming all the columns with some predefined list. but I don't want to do it like this yet. Maybe there is a better solution.

1

1 Answers

0
votes

You need to specify the encoding of the file you are reading/importing.

Per SAS support, this can be specified in the filename statement.

I've tested it with SAS UE and csv files and it worked pretty well:

filename temp '/folders/myfolders/Raw data/iso8859.csv' encoding="utf-8";

proc import datafile = temp

 out  = utf8
 dbms  =  csv
 replace;

run;

Your code should then look like:

filename temp '/directory/file_name.XLSX' encoding="LATIN2";

proc import datafile = temp

 out  = libname.tablename
 dbms  =  xlsx
 replace;

run;