BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

I have a data with Char ID and I am separating that ID from other vars(numerical) in a matrix. After all calculations I just want to merge them back(horizontal concatenation) for the output:

(UID is CHAR, EMI is NUM)

INFO=UID||EMI;

But IML is not allowing me:

ERROR: All specified variables must be the same type.

 

Any idea if and how it can be done?

Thanks a lot in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
andreas_lds
Jade | Level 19

@thepushkarsingh wrote:

I have a data with Char ID and I am separating that ID from other vars(numerical) in a matrix. After all calculations I just want to merge them back(horizontal concatenation) for the output:

(UID is CHAR, EMI is NUM)

INFO=UID||EMI;

But IML is not allowing me:

ERROR: All specified variables must be the same type.

 

Any idea if and how it can be done?

Thanks a lot in advance.

 


Afaik this can't be done while in proc iml.

View solution in original post

4 REPLIES 4
andreas_lds
Jade | Level 19

@thepushkarsingh wrote:

I have a data with Char ID and I am separating that ID from other vars(numerical) in a matrix. After all calculations I just want to merge them back(horizontal concatenation) for the output:

(UID is CHAR, EMI is NUM)

INFO=UID||EMI;

But IML is not allowing me:

ERROR: All specified variables must be the same type.

 

Any idea if and how it can be done?

Thanks a lot in advance.

 


Afaik this can't be done while in proc iml.

thepushkarsingh
Quartz | Level 8
Thanks. I'll use a data merge then.
Rick_SAS
SAS Super FREQ

Yes, you can do it. Use the ROWNAME= option when you write the numerical matrix:

 

proc iml;
EMI = {1 2 3,
       4 5 6,
       7 8 9};
UID = {"A", "B", "C"};

create Want from EMI[rowname=UID];
append from EMI[rowname=UID];
close;
quit;

proc print data=Want;
run;
Ksharp
Super User

You can do it if you only want get a table .

 

 

proc iml;
use sashelp.class;
read all var {name age};
close;
age=age#100;

create want var {name age};
append;
close;
quit;

proc print;run;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 4 replies
  • 2272 views
  • 1 like
  • 4 in conversation