DATA Step, Macro, Functions and more

non-printable characters convert to ascii printable characters

Reply
Occasional Contributor cm2
Occasional Contributor
Posts: 6

non-printable characters convert to ascii printable characters

Hi,

I have foregin language in my SAS dataset with non-printable characters.  I need to convert them to ascii.  I need to read the variable and look for original DEC characters and convert to New DEC characters.  http://www.ascii-code.net/

 

2008-ban egyszer pszichiátriai osztályra kerültem, mert szerettem volna meghalni

2008-ban az érfelvágás és a Betaloc szimpatikusnak tunt, filmekben láttam.

 

Original DEC      New DEC

130                         44         Single low-9 quotation mark               ,

136                         94         Modifier letter circumflex accent         ^

139                         60         Single left-pointing angle mark           <

145                         39         Left Single quotation mark                  '

146                         39         Right Single quotation mark               '

etc..

 

Does anyone know a way to scan the text field and search for the original DEC and change to New DEC?  Thanks.

Regular Contributor
Regular Contributor
Posts: 156

Re: non-printable characters convert to ascii printable characters

Occasional Contributor cm2
Occasional Contributor
Posts: 6

Re: non-printable characters convert to ascii printable characters

Hi, This is exactly what I need.  I'm running SAS 9.2.  How do I invoke from my sas session?  I'm gettting an error.  Where can I find the code?  Thanks!!

 

 

5 proc format library=work.myformats;

6 value asciifmt

7 130=44

8 136=94

9 139=60

10 145=39

11 146=39

12 147=34

13 148=34

14 150=45

15 151=45

16 152=126

17 155=62

18 160=32

19 173=45

20 180=39

21 215=120

22 other=MISSING;

NOTE: Format ASCIIFMT has been written to WORK.MYFORMATS.

23 run;

NOTE: PROCEDURE FORMAT used (Total process time):

real time 0.31 seconds

cpu time 0.03 seconds

 

24 options fmtsearch=(work.myformats);

25

26 %cstutilfindfixextdasciichars(

-

180

WARNING: Apparent invocation of macro CSTUTILFINDFIXEXTDASCIICHARS not resolved.

ERROR 180-322: Statement is not valid or it is used out of proper order.

27 _cstDSName=temp.Sep361201_qs_cssrs_trns,

28 _cstColumnName=qsorres,

29 _cstExternalFmt=asciifmt,

30 _cstExtFmtOtherValue=MISSING,

31 _cstGeneratedCodeFile=temp.findfixextendedascii5,

32 _cstOutputDS=all_cstProblems,

33 _cstRetainOutputDS=N,

34 _cstWriteToLib=work,

35 _cstFindFix=Find

36 );

 

Regular Contributor
Regular Contributor
Posts: 156

Re: non-printable characters convert to ascii printable characters

I know very little about macos.

 

I think you use the general form

%MACRO macro-name;
macro-text
%MEND macro-name;

to define it and set it up then you call it and use it with the %macro-name.

 

That article I linked to is largely Greek to me, it just looked like what you wanted to do. That macro has parameters.

 

SAS Macro Programming for Beginners

Ask a Question
Discussion stats
  • 3 replies
  • 119 views
  • 1 like
  • 2 in conversation