SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
GeorgeSAS
Lapis Lazuli | Level 10

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!

1 ACCEPTED SOLUTION

Accepted Solutions
r_behata
Barite | Level 11

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 :

 

http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000780334.htm#a0021...

 

View solution in original post

4 REPLIES 4
r_behata
Barite | Level 11

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 :

 

http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000780334.htm#a0021...

 

GeorgeSAS
Lapis Lazuli | Level 10

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!

yabwon
Onyx | Level 15

Hi,

 

you need to add:

options   validvarname=ANY /* for variables*/  validmemname=EXTEND /* for datasets */;

All the best

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



GeorgeSAS
Lapis Lazuli | Level 10
Thank you very much!

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 22471 views
  • 2 likes
  • 3 in conversation