BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ajulio4
Obsidian | Level 7

Hello ,

I have an issue can someone help me.

I have a colonne value like this :

var ="USERNUM1,	Counter{F}Compteur				,
USERTEXT1,	Trigram{F}Trigramme				,ALL~All{F}Tous	GBR~GBR{F}GBR	ITA~ITA{F}ITA"

Notice that after the commaas, i have tabulate.

how can i have as result :

var = "USERNUM1,Counter{F}Compteur,USERTEXT1,Trigram{F}Trigramme,ALL~All{F}Tous GBR~GBR{F}GBR ITA~ITA{F}ITA"
1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

It looks to me that the compress() function s modifier should remove the characters you don't want.

newar=compress(var,,'s');

COMPRESS Function

s or S adds space characters (blank, horizontal tab, vertical tab, carriage return, line feed, form feed, and NBSP ('A0'x, or 160 decimal ASCII) to the list of characters.

 

View solution in original post

4 REPLIES 4
ballardw
Super User

See if this works to remove tab characters for you:

 

data test;
   set yourdatsetname;
   newvar = compress(var,,'h');
run;

The two commas in the parameters for the Compress function means you are not supply a character to remove by typing it. The 'h' adds the horizontal tab character to the list of characters to remove, so the above should only remove horizontal tab characters.

Ksharp
Super User

Also try to remove the newline characters.

 

data test;
   set yourdatsetname;
   newvar = compress(var,'0D0A'x,'s');
run;
Patrick
Opal | Level 21

It looks to me that the compress() function s modifier should remove the characters you don't want.

newar=compress(var,,'s');

COMPRESS Function

s or S adds space characters (blank, horizontal tab, vertical tab, carriage return, line feed, form feed, and NBSP ('A0'x, or 160 decimal ASCII) to the list of characters.

 

ajulio4
Obsidian | Level 7

Thks so much

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2108 views
  • 1 like
  • 4 in conversation