I have a data set with a number of columns. I am wanting to create a data set from this using a selection of the columns:
In iml
Instead of
use = old_use[1:100, 1:75];
I want to have
use = old_use[1:100, 1:50] + old_use[1:100, 53:57] + old_use[1:100, 59:75];
But it is not returning the correct number of columns....
The addition operator is trying to add matrices that do not have the same number of columns. Perhaps you mean to use the concatenation operator:
use = old_use[1:100, 1:50] || old_use[1:100, 53:57] || old_use[1:100, 59:75];
If so, a more efficient method is to form a vector of the column indices and then do a single extraction:
cols = (1:50) || (53:57) || (59:75);
use = old_use[1:100, cols];
The addition operator is trying to add matrices that do not have the same number of columns. Perhaps you mean to use the concatenation operator:
use = old_use[1:100, 1:50] || old_use[1:100, 53:57] || old_use[1:100, 59:75];
If so, a more efficient method is to form a vector of the column indices and then do a single extraction:
cols = (1:50) || (53:57) || (59:75);
use = old_use[1:100, cols];
Thank you that works really well!
When posting questions, look if there's a suitable community. My moving of your post to the IML community probably triggered @Rick_SAS's attention.
Thanks - will do
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.