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 2024

Innovate_SAS_Blue.png

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. 

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
  • 954 views
  • 0 likes
  • 2 in conversation