BookmarkSubscribeRSS Feed
sas_
Fluorite | Level 6

How can i compress special charaters in compress function not only the special charaters in the key board there are many special charcters that are coming in data any one can help

6 REPLIES 6
Peter_C
Rhodochrosite | Level 12

which release of SAS?

Peter_C
Rhodochrosite | Level 12

have you looked at the online doc for the Compress Function?

check modifier C

Peter_C
Rhodochrosite | Level 12

modifier C is even available in SAS9.1.3

See the relevant documentation for that earlier release at http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000212246.htm

Tom
Super User Tom
Super User

Look at the modifiers for the COMPRESS function.  I assume you want the W modifier.

clean=compress(raw,,'wk');

Also look at the COLLATE function to specify a range of values by code number.

For example to keep just the printable basic ASCII codes:

clean=compress(raw,collate(32,127),'k')

Of if you have an old version of SAS where compress does not support the modifiers you can use compress twice.

clean=compress(raw,compress(raw,collate(32,127)));
Ksharp
Super User

Why?

It is because you can not open this table in SAS/EG ?

Ksharp

art297
Opal | Level 21

It would help to know what your data really look like.  The following post shows to methods for seeing the hex representation of your data, one using SAS and one using a nice freeware tool ( http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0905B&L=sas-l&P=R4105&D=1&H=0&O=D&T=1 ) called hexmad.

Sometimes, what seems like unexplained characters, is actually a different kind of file that can easily be addressed if one knows the kind of file it is.

In short, the Forum could probably advise you much better if they could see the hex representation of one or a couple of your data records.

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!

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
  • 6 replies
  • 1538 views
  • 0 likes
  • 5 in conversation