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

I am trying to create a distance matrix with the following piece of code

 

proc distance data=sample shape=SQR out=Dist method=Euclid ;
var interval(a2--a6 / std=Std);
id a1;
run;

 

Although I am getting the output but all the variable names its taking from a1 have an underscore before it, for example a1 has values 1,2 ,3 ,4 ,5 ....and so, and in the distance matrix the variable names become _1, _2, _3, _4, _5... and so on.

 

Could anybody please tell me the reason and guide me the way to remove the same.

Thanks in advance ! 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
That is what suppose to be . variable name start with a digit is illegal .
If you want this , you could try  options:

options validvarname=any;
proc distance .........

View solution in original post

3 REPLIES 3
Kurt_Bremser
Super User

A SAS name cannot begin with a numerical digit (0 .. 9).

Therefore, when SAS has to automatically create variable names from numerical values, it prefixes the underline.

If you want this to be different, make a1 of type char, containing valid names.

You also might want to consider using the prefix= option in the proc distance statement.

Reeza
Super User

SAS variable names can't start with a number so to get around that fact it adds an underscore. 

 

I think you'd have to change your variable to start with a character to correct this 😕

Ksharp
Super User
That is what suppose to be . variable name start with a digit is illegal .
If you want this , you could try  options:

options validvarname=any;
proc distance .........

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 1066 views
  • 1 like
  • 4 in conversation