turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Data Mining
- /
- Reading an external file (excel) file into SAS-IML...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-02-2013 02:36 PM

I have a data set with more than 100 observations and contains three variables, var(x1), var(x2), and cov(x1, x2) in an excel file. How do I read this data set into SAS or SAS-IML to create a 2X2 matrix with the variances on the diagonal and covariance off diagonal? I'm new to SAS and SAS-IML, and so, does anyone know of a "do-loop" to read these data into a matrix. Any help will be appreciated!

Thanks,

Rommel

Accepted Solutions

Solution

02-19-2013
05:59 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SylvainTremblay

02-19-2013 05:59 PM

Hi Sir Sylvain! Sorry if I had to ask you a more specific question related to the question I earlier asked. This is what my problem is:

I'm meta-analyzing effect sizes from more than 100 studies. Some studies have one effect size, or 2 effect sizes, or 3 effect sizes, and etc.

Because studies have different number of effect sizes, the covariance matrices of effect sizes are then different for each study.

To illustrate, I have small data set below (where Study 1 has 2 effect sizes, thus it has a 2X2 covariance matrix; Study has 3 effect sizes, thus

it has a 3X3 covariance matrix; and Study 1 (has 2 missing effect sizes) so it has only 1X1 covariance matrix). So here is my question Sir,

is there a code I can use to (automate) import the covariance matrix from say SAS to SAS-IML without having to type this covariance matrices

into SAS-IML, given the fact that I have more than 100 studies?

Study 1 = { .022 .009,

.009 .023}

Study 2 = { .016 .003 .006,

.003 .016 .008

.006 .008 .016}

Study = { .019}

Thanks so much for the help. I'm new with SAS and SAS IML and I really need to figure out

how I can import my data (covariance matrices) in order for me to run an analysis.

Sincerely,

Rommel

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to dessert_fox

02-12-2013 01:39 PM

Hello,

SAS/IML comes with an interface: SAS/IML Studio. It implements IMLPlus, an enhanced version of the SAS/IML programming language.

In IMLPlus, you could use the DataObject.CreateFromExcelFile method in a program to read your MS Excel worksheet into SAS/IML Studio.

Otherwise, if you have the SAS/Access to PC Files module, you can use Proc IMPORT to import your MS Excel worksheet into a SAS dataset.

After, in SAS/IML, you can leverage the USE statement to open the dataset and make it current for input, then the READ statement to transfer the data from the dataset to a matrix.

Once in a matrix, you can manipulate the elements as you see fit.

Cheers!

Sylvain

Solution

02-19-2013
05:59 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SylvainTremblay

02-19-2013 05:59 PM

Hi Sir Sylvain! Sorry if I had to ask you a more specific question related to the question I earlier asked. This is what my problem is:

I'm meta-analyzing effect sizes from more than 100 studies. Some studies have one effect size, or 2 effect sizes, or 3 effect sizes, and etc.

Because studies have different number of effect sizes, the covariance matrices of effect sizes are then different for each study.

To illustrate, I have small data set below (where Study 1 has 2 effect sizes, thus it has a 2X2 covariance matrix; Study has 3 effect sizes, thus

it has a 3X3 covariance matrix; and Study 1 (has 2 missing effect sizes) so it has only 1X1 covariance matrix). So here is my question Sir,

is there a code I can use to (automate) import the covariance matrix from say SAS to SAS-IML without having to type this covariance matrices

into SAS-IML, given the fact that I have more than 100 studies?

Study 1 = { .022 .009,

.009 .023}

Study 2 = { .016 .003 .006,

.003 .016 .008

.006 .008 .016}

Study = { .019}

Thanks so much for the help. I'm new with SAS and SAS IML and I really need to figure out

how I can import my data (covariance matrices) in order for me to run an analysis.

Sincerely,

Rommel