Please help me understand the " 'n " means:
proc sql;
CREATE TABLE WORK."Count_ABC_Per_AAAAAAAA "n AS
select "AAA" AS 'COUNT DISTINCT_of_AAA'n from sashelp.class;
quit;
There are two " 'n " ,one in the dataset's name ,another in proc sql select statement.
Thanks!
As per SAS Documentation :
"Definition of SAS Name Literals :
A SAS name literal is a name token that is expressed as a string within quotation marks, followed by the upper- or lowercase letter n. Most SAS names allow only the characters _, A–Z, and a–z. Name literals enable you to use characters (including blanks and national characters) that are not otherwise allowed."
More Info :
As per SAS Documentation :
"Definition of SAS Name Literals :
A SAS name literal is a name token that is expressed as a string within quotation marks, followed by the upper- or lowercase letter n. Most SAS names allow only the characters _, A–Z, and a–z. Name literals enable you to use characters (including blanks and national characters) that are not otherwise allowed."
More Info :
Thank you!
But It works only in SAS EG, but it does not works in SAS base, here is the code:
PROC SQL;
CREATE TABLE "My Table"n AS
SELECT 1 as "this is"n from sashelp.class;
QUIT;
*error in SAS base:;
*ERROR: The value MY TABLE is not a valid SAS name.;
*ERROR: The value this is is not a valid SAS name.;
Thanks!
Hi,
you need to add:
options
validvarname=ANY /* for variables*/
validmemname=EXTEND /* for datasets */
;
All the best
Bart
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.