f



Re: Converting A Unicode Text File to An ASCII Text File

Mike,
SAS does not read Unicode text.

It is not true  encoding=utf8 exist
HTH
Andre

I tried upon this contents (a french one saved in utf8) but showed here
in windows

Nom,Adressé
"Bob","cité Bergère"
"Ann","impasse Dôme"


with this code under sas windows

options validvarname=any;
filename a "z:\utf8.csv"  encoding=utf8;

PROC IMPORT OUT= WORK.PAPER3
DATAFILE=a
DBMS=CSV REPLACE;
GETNAMES=YES;
DATAROW=2;
RUN;


the results are

Nom     Adress�
Bob     cit� Berg�re
Ann     impasse D�me

But perhaps you have another problem

Bachenot a �crit :
> We have a large number of text files built in Unicode that we need to
> be read by SAS. SAS does not read Unicode text.
>  To convert the Unicode
> text to ASCII text we did the following:
> A Unicode text file adds an additional blank space to each character.
> To remove this blank character, you can use the code below.
>
> The hexidecimal value '00' is a blank character. So remove it using
> the SAS statement '00'x. The 'x' tells SAS you are reading
> hexidecimal.
>
> Use RECFM=N to tell SAS that you are reading a stream of data that
> will not conform to a typical file structure. SAS will treat the file
> as a very long single record.
>
> data _null_;
>  infile 'c:\xmlfile.xml' recfm=n;
>  file 'c:\ascifile.txt' recfm=n;
>  input c $1.;
>  if c ne '00'x then put c $1.;
> run;
>
>

--
   Andr� WIELKI
   INED (Institut National d'Etudes D�mographiques)
   Service Informatique
   133 Boulevard Davout      75980 Paris Cedex 20
   m�l : wielki@ined.fr      t�l :  33 (0) 1 56 06 21 54
0
wielki (636)
4/25/2008 4:16:18 PM
comp.soft-sys.sas 142827 articles. 4 followers. Post Follow

0 Replies
1057 Views

Similar Articles

[PageSpeed] 59

Reply: