BookmarkSubscribeRSS Feed
cm2
Calcite | Level 5 cm2
Calcite | Level 5

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.

3 REPLIES 3
cm2
Calcite | Level 5 cm2
Calcite | Level 5

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 );

 

HB
Barite | Level 11 HB
Barite | Level 11

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2818 views
  • 1 like
  • 2 in conversation