With the system option VALIDVARNAME=ANY, which of the following variable
names is valid?
a. 4BirthDate
b. $Cost
c. Tax-Rate
d. all of the above
The answer is 'd' but i cannot use A as a variable name and the rules don't state that a number can be included.
I don't know what guide book you mean. It's clearly mentioned in the SAS documentation.
Any time you have a variable that doesn't comply with the SAS variable naming rules, you need VALIDVARNAME=ANY and then enclose the variable name in quotes and follow it with the letter N.
You can't use it?
Did you enclose the variable names in quotes and follow it with the letter N? These won't work unless you do that.
If that's not it, then show us the LOG (all of it) so we can see what you did and what the error message is. Please copy the log as text and paste it into the window that appears when you click on the </> icon. DO NOT SKIP THE PART IN RED.
not sure what you mean by window with </> icon, but here's the log:
The </> icon is in the row of icons immediately above where you type your text. Please re-post your log following the instructions.
Ok, so I tried it with quotation marks and the n. BUT, what I'm wondering is why the guide doesn't book doesn't even mention this...
Also it doesn't mention we can use numbers so I'm confused if by the word characters that includes numbers?
Thanks
I don't know what guide book you mean. It's clearly mentioned in the SAS documentation.
Any time you have a variable that doesn't comply with the SAS variable naming rules, you need VALIDVARNAME=ANY and then enclose the variable name in quotes and follow it with the letter N.
It's the prep guide for the exam.
Thank you.
Could you please provide a URL or exact name of this guide?
SAS Certified Specialist Prep Guide
(subtitle) Base Programming Using SAS 9.4
I don't have this book. So I can't answer any questions about it.
@jaliu wrote:
SAS Certified Specialist Prep Guide
(subtitle) Base Programming Using SAS 9.4
This book? https://sasinstitute.redshelf.com/book/1830659
Did you check the errata page? https://support.sas.com/content/dam/SAS/support/en/books/errata-base-certified.pdf
No, but thank you for pointing this out. I couldn't get the practice data to load and i'm surprised they made such an egregious mistake with the instructions in the published book.
Also here is where i really dislike the exam questions. I know it doesn't apply to this questions, but if there were no all of the above choice I would have thought that the options needed the quotation marks and n in order to be valid names. Maybe it's not technically asking for syntax, but I could easily see the question being unclear.
@jaliu wrote:
Also here is where i really dislike the exam questions. I know it doesn't apply to this questions, but if there were no all of the above choice I would have thought that the options needed the quotation marks and n in order to be valid names. Maybe it's not technically asking for syntax, but I could easily see the question being unclear.
It is a subtle distinction. If you look at printouts, say from PROC CONTENTS, and metadata tables, like DICTIONARY.COLUMNS, you will see that the names are just the text that is like the text in the question. It is only when trying to reference the variable in CODE that you need to use the name literals. That is to avoid confusing the SAS compiler that you indented something other than a name. For example if you had a variable named "457" and typed just 457 into the code the compiler would see a numeric constant instead of a variable. So the name literals are required when the name does not follow the "V7" rules.
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 25. Read more here about why you should contribute and what is in it for you!
Follow along as SAS technical trainer Dominique Weatherspoon expertly answers all your questions about SAS Libraries.
Find more tutorials on the SAS Users YouTube channel.