BookmarkSubscribeRSS Feed
ericliuzh1
Obsidian | Level 7

Hi,

 

My answer is E to the question below but SAS answer key is C.

 

With the system option VALIDVARNAME=ANY, which of the following variable names is valid?

a. 4BirthDate

b. $Cost

c. _Items_

d. Tax-Rate

e. All of the above

 

According to the definition, I believe that a, b, and d are all valid names. Can someone let me know why E is not a correct answer?

 

Thanks.

Eric

4 REPLIES 4
ericliuzh1
Obsidian | Level 7

Thanks, Kurt. It makes sense now!

Rick_SAS
SAS Super FREQ

I can see why you are confused. I suggest you re-read the section of your study guide that deals with VALIDVARNAME and n-literals to see if it makes a distinction between those two concepts. You are correct that all of the variables are valid if you use them as n-literals such as

data _null_;

'4BirthDate'n = 1;
'$Cost'n = 2;
_Items_ = 3;
'Tax-Rate'n = 4;

run;

 

However, C is the only variable name that you can use without embedding the name into an n-literal, as shown.

 

ericliuzh1
Obsidian | Level 7

Thanks for the examples! I got it now!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1097 views
  • 0 likes
  • 3 in conversation