Hi all,
i'm not able to print a single quote for one of my variables I tried with different types like catt, quote(id,"'") but it gives the double quote's only so please suggest some solution for the problem
{
DATA _LIC;
INFILE DATALINES;
INPUT @1 ID 1. @3 LIC $10.;
DATALINES;
1 24356578
2 42437254
3 36353239
4 25242762
5 26525326
;
RUN;
DATA _LIC2;
SET _LIC;
ID_NEQ = QUOTE("'",LIC,"'");
RUN;
PROC PRINT DATA = _LIC2;
RUN;
}
expecting results should be like : ('24356578') not like ("24356578")
Thanks & reagrds
rohit
Maxim 1: Read the Documentation.
In this case, the documentation for the Quote Function.
Excerpt:
specifies a quoting character, which is a single or double quotation mark. Other characters are ignored and the double quotation mark is used. The double quotation mark is the default.
Note that the quote() function will only accept TWO arguments. The ERROR in your log (Maxim 2!) tells you that.
So this gives you your result:
data test;
x1 = 'string';
x2 = quote(x1,"'");
run;
proc print data=test noobs;
run;
Result:
x1 x2 string 'string'
Hello,
If you read the log, you will see that your program produces an error :
10 ;
11 RUN;
12 DATA _LIC2;
13 SET _LIC;
14 ID_NEQ = QUOTE("'",LIC,"'");
-----
72
ERROR 72-185: The QUOTE function call has too many arguments.
15 RUN;
Indeed, according to the documentatiopn, the quote function has two arguments :
specifies a character constant, variable, or expression.
specifies a quoting character, which is a single or double quotation mark. Other characters are ignored and the double quotation mark is used. The double quotation mark is the default.
=> Replace your call to quote function with
ID_NEQ = QUOTE(LIC,"'");
This is strange, and I fear you have a "mainframe problem".
Your code, run on SAS 9.4 on AIX, creates single quotes.
Since there is no mention in the documentation of special behavior of this function on mainframes, I would bring this to the attention of SAS technical support.
I also did not find anything regarding the quote() function in the Companion for Z/OS.
No problem with SAS 9.4m5 on Windoze.
EDIT: Which version are you using?
@rohitkrishna wrote:
Hi andreas_lds,
thanks for the quick replay
the current version i'm using 8.1
thanks & regards
rohit
So you're calling from 2003 or so via time-machine?
8.1 is the subject of IT archaeologists, as it was introduced in 2001 and must have been taken off support in 2008 (IIRC) when 9.2 was introduced.
I'm astonished that SAS still hands out licenses for this.
Have your SAS admins upgrade to the current versions 10 years before yesterday. What they've been doing can be considered as gross negligence.
Once you're current, we can test again, and if the issue persists, involve SAS TS right then. But with 8.1, they only thing you'll hear from them is "upgrade to the current version".
@rohitkrishna wrote:
Hi KurtBremser,
thanks for the quick replay & below the details of the above code results
{
DATA _LIC;
X = 'STRING';
Y = QUOTE(X,"'");
RUN;
PROC PRINT DATA = _LIC;
RUN; }
and the results are
Obs X Y
1 STRING "STRING"
again I am getting double quotes only
thanks & regards
rohit
Why does your code have { } around the SAS code?
On a windows machine the result is also:
Obs X Y 1 STRING 'STRING'
If you are really running a version of SAS that was released almost 20 years ago then use functions that work in that version.
DATA _LIC;
INFILE DATALINES;
INPUT @1 ID 1. @3 LIC $10.;
DATALINES;
1 24356578
2 42437254
3 36353239
4 25242762
5 26525326
;
RUN;
DATA _LIC2;
SET _LIC;
length ID_NEQ $12;
ID_NEQ = "'" || trim(LIC) || "'";
RUN;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.