Statistical programming, matrix languages, and more

Naming the matrix same name as the dataset table

Reply
Contributor
Posts: 20

Naming the matrix same name as the dataset table

Would you recommend naming the matrix through use/read/close same name as the dataset or different name?

(and conversely from IML matrix to a table)

Using the same name might lead to confusion; also, is there any possible such interference? 

On the other hand, using different names at same point looks like clutter.

SAS Super FREQ
Posts: 3,620

Re: Naming the matrix same name as the dataset table

There is no conflict, so you can do whichever you prefer.

For me, it varies. If there is a correlation matrix in a data set named CORR, I might read it into a matrix of the same name.

If the data set is named MyCorrelationMatrix, I'll probably just read it into S.

Most real data sets have both character and numeric variables, so you can't read all variables into a single matrix. For example: the sashelp.class data set contains a SEX and a NAME variable (both character), so if I want to read the numeric variables I might just say:

use sashelp.class;

read all var _num_ into X;

close sashelp.class;

Ask a Question
Discussion stats
  • 1 reply
  • 270 views
  • 3 likes
  • 2 in conversation