BookmarkSubscribeRSS Feed
alix1
Calcite | Level 5

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.

3 REPLIES 3
Rick_SAS
SAS Super FREQ

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);

alix1
Calcite | Level 5
thanks, but it did not work
Rick_SAS
SAS Super FREQ

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;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Multiple Linear Regression in SAS

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.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 3 replies
  • 1474 views
  • 0 likes
  • 2 in conversation