Hello,
I want to obtain x as a two column array, the first column must be a vector of values one and the other xi is a variable of decimal values that comes from the database imported from R, au_obsbipoiss. I am doing it in the following way
proc iml;
reset noname;
use distrib.au_obsbipoiss;
read all var{y_1} into y1;
read all var{y_2} into y2;
read all var{xmat} into xi;
r = nrow(y1);
x= J(r, 1, 1)||xi;
However, SAS takes xi as a character variable so I can not get x.
What I can do? please help me.
The best thing is for you to get the database to use numbers instead of character values. If you can't do that, then use the NUM function to convert the character values to numeric:
x= J(r, 1, 1) || num(xi);
If you expect help, you need to provide more information. What didn't work? What does the log say? Can you provide sample data?
Here is an example that demonstrates the technique that I suggested:
proc iml;
xi = {'1', '2', '3.14159', '-2.7'};
r = nrow(xi);
x= J(r, 1, 1) || num(xi);
print x;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.