Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dequote Function 1

Status
Not open for further replies.

JM3482

Technical User
Nov 7, 2003
17
US
I take data from SAS to an excel spreadsheet. The data goes to the excel spreadsheet with single quotes. I need to remove the single quotes but I am missing something in my dequote statement. I get an error message that states "not enough arguments". My statement appears as follows:

Data _NULL_;

CONUM=(&batparm1);
CONUM1= dequote(&batparm1);
Run;

Note: Batparm1 is a parameter for 44,45 (company number)

What am I missing?

The data appears as this: '44,45'
I need for it to look like this: 44,45
 
JM3482,

You have to give us some more info. Like how does your macro var resolve. (What does the macro string equal to?) Does it look like this '43,34'? If this is the case why not change your SAS statement to this?
CONUM1= CONUM;
The outer single quotes are used to set the string. If your data looks like this '43,'45','66',.... Then why not use the compress function.
Ex.

CONUM1= compress(CONUM," ' ");
(the second param is for the chars that you want to drop)

I hope that this helps.
Klaz
 
I think that the compress function is what you're looking for. I have also had problems with the dequote function - I can't get it to work.

If I input and try to remove quotes from this stmt:
This is a "test"

input stmt $20. ;
x=dequote(stmt) ; --> the quotes don't go away
x=compress(stmt,'"'); --> the quotes go away

The bottom line - compress works great... anyone know why dequote won't work?
 
mkrinke,
The DEQUOTE function is only for quotes that 'wrap' the string not inside. For that you must use the comress function.

Hope that this helps you.
Klaz
 
When you put it that way it makes perfect sense... I wish I had looked out here earlier - before I spent alot of time trying to get it to work the way I thought it should. It's always the little things that hang me up.

Thanks for the help !!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top