BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jaliu
Quartz | Level 8

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.

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller

View solution in original post

16 REPLIES 16
jaliu
Quartz | Level 8
Actually none of the options are working.
PaigeMiller
Diamond | Level 26

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.



--
Paige Miller
jaliu
Quartz | Level 8

not sure what you mean by window with </> icon, but here's the log:

options validvarname=V7;
 
data testdata ;
set '/home/u49936438/Cert/input/input08b.sas7bdat';
NOTE: Data file _TEMP4.INPUT08B.DATA is in a format that is native to another host, or the file encoding does not match the session
encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce
performance.
 
Tax-Rate = 50;
___
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
 
----
 
it says something about format, could that be the problem? for some reason i'm unable to use paths to folders on my computer so i have to find a workaround.
 
PaigeMiller
Diamond | Level 26

The </> icon is in the row of icons immediately above where you type your text. Please re-post your log following the instructions.

--
Paige Miller
jaliu
Quartz | Level 8

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

PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
jaliu
Quartz | Level 8

It's the prep guide for the exam.

 

 

Thank you.

PaigeMiller
Diamond | Level 26

Could you please provide a URL or exact name of this guide?

--
Paige Miller
jaliu
Quartz | Level 8

SAS Certified Specialist Prep Guide 

(subtitle) Base Programming Using SAS 9.4

PaigeMiller
Diamond | Level 26

I don't have this book. So I can't answer any questions about it.

--
Paige Miller
Tom
Super User Tom
Super User

@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

 

jaliu
Quartz | Level 8

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.

jaliu
Quartz | Level 8

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.

Tom
Super User Tom
Super User

@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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
LIBNAME 101

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.

Discussion stats
  • 16 replies
  • 1883 views
  • 1 like
  • 4 in conversation