BookmarkSubscribeRSS Feed
Mikeyjh
Calcite | Level 5

Hi,

Could you please convert the following import statement to a UTF8 compliant version? (The input text file is UTF8 and the dataset needs to be UTF8 compliant.) Thanks for your help.

data dir.ds;

     %let _efierr_ = 0;

     infile "&in\ds.txt" delimiter = ',' missover dsd firstobs = 2;

     format colA $10. ;

     format colB $10. ;

     format colC $10. ;

     ...

     informat colA $10. ;

     informat colB $10. ;

     informat colC $10. ;

     ...

     input

          colA $

          colB $

          colC $

          ...;

     if _error_ then call symput('_efierr_',1);

run;

3 REPLIES 3
jakarman
Barite | Level 11

If your SAS installation is UTF compliant (DBCS) and your encoding is UTF in SAS what is this question about?

http://support.sas.com/documentation/cdl/en/nlsref/64811/HTML/default/viewer.htm#n0882t2muy4l94n19cn...http://support.sas.com/documentation/cdl/en/nlsref/64811/HTML/default/viewer.htm#n0882t2muy4l94n19cn...

---->-- ja karman --<-----
Mikeyjh
Calcite | Level 5

Thanks for your reply. Yes the installation is UTF8 compliant.

Do I need to use the following to be able to read from a UTF8 text file and retain compliance in the dataset? We are using 9.1.3.

libname mylib outencoding="utf-8";

infile myfile encoding="utf-8";

Patrick
Opal | Level 21

It's for sure a good idea to specify the encoding explicitly. Some UTF8 encoded files don't have a BOM so telling SAS which encoding to use will help avoiding issues.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 818 views
  • 0 likes
  • 3 in conversation