COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Comparing multiple columns in matrix - R / SAS

• Email
• Follow

```Hi SAS-Lers,

There is a very elegant post in the R help forum.

http://tinyurl.com/2vg6qpa

http://r.789695.n4.nabble.com/Comparing-multiple-columns-in-matrix-td2237089.html#a2237089

I know this problem can be solved easily in SAS using Datastep arrays,
SQL, DOW or IML, but it is very elegant in R. What is important is the
paradigm of an in memory matrix and matrix operators. This kind of
thinking is common to SAS/IML programmers but not datastep
programmers. Also keep in mind REvolution and multitheaded row and
column operations.
```
 0

See related articles to this posting

0 Replies
414 Views

Similar Articles

12/19/2013 11:16:45 PM
page loaded in 18576 ms. (0)

Similar Artilces:

Sorting on multiple columns within a matrix
Hello, I can't come up with a solution to the following simple task: - I have a matrix, let's M={ {"Z",2,"a"},{"A",2,"k"}, {"Z",1,"z"}, {"A",1,"a"},{"Z",3,"k"}, {"A",3,"z"} } - I want to be able to sort the matrix row-wise, based on multiple columns, for example sort first on column 2 (ascending) and then secondly on column1 (ascending) desired result: A 1 a Z 1 z A 2 k Z 2 a A 3 z Z 3 k I suspect the solution involves using a pure function ...

Remove a row or column of a matrix in SAS/IML
I am working a dataset like matrix "A" below. It is the trading data for some stocks; columns are for different stocks, and rows are for different months. I assigned "-9" to represent missing values. I want to do some test upto the first occurance of "-9". Then I want to delete the entire column which contains one or more "-9", and do the test on the "good" columns. Is there a way to delete an entire column or row in SAS/IML? Thank you very much! a={0.1399 -0.0307 0.0000 0.1525 0.0501 0.0496, 0.0859 0.0552 0.0292 0.0588 0.0249 0.0...

Comparing Dates across multiple SAS datasets
I would like to do the following in SAS. For each HHID VEHID combination, I want to put a flag in the trip file based on the mwstarttime (from the TRIP file) and midwestdatetime (from the CARCHIPEVENT FILE) file for the following conditions. 1)Flag1 indicating that the CarChip was connected for that entire day 2) Flag2 indicating that the CarChip was not connected at all that day 3) Flag3 indicating that a CarChip was connected at the beginning of the day and at the end of the day, but was disconnected at some point during the day 4) Flag4 indicating that a CarChip was disconnected at...

Compare two unequal column matrix in matlab without using for loop
I want to compare two columns matrix : such as a=[1;2;2;3;4;4;5;6] and b=[2;4;8] and get the output like d=[0;1;1;0;1;1;0;0] which is same number of rows of matrix a. On 10/29/2012 11:30 PM, MD wrote: > I want to compare two columns matrix : such as a=[1;2;2;3;4;4;5;6] and b=[2;4;8] and >get the output like d=[0;1;1;0;1;1;0;0] which is same number of rows of matrix a. > may be a loop? ------------------------------ a=[1;2;2;3;4;4;5;6]; b=[2;4;8]; c=zeros(length(a),1); for i=1:length(a) if isempty(find(b==a(i),1)) c(i)=0; else c(i)=1; ...

A matrix that selects some predetermined columns from another matrix to produce a matrix that cosists of those columns
Hi, I would like to come up with a matrix to takes some columns of another matrix and puts them into the other matrix. For example, for X = [x1 x2 x3 x4] where xi is n x 1 vector, XJ = [x2 x3]. So, J has to be n x 2. Thanks in advance! usuiisu usuiisu <ikuyasu@gmail.com> wrote in message <526a92f2-79e0-450e-bceb-7bd8a838a661@30g2000yql.googlegroups.com>... > Hi, > > I would like to come up with a matrix to takes some columns of another > matrix > and puts them into the other matrix. For example, > for X = [x1 x2 x3 x4] where xi is n x 1 vecto...

Convert two matrixes ca and y with 2 columns in a matrix w with on column ca and one column y
Dear Matlab User, I have following problem. I use a programm called dynare it is written to make the use of Matlab easy. By this programm I get in Matlab two matrizes one is called ca and one is called y. Each of these matrizes consist of n artifical time series produced by matlab written in the colums of the matrix. for example: ca=[5 8 and y = [4 3 1 2] 3 1] and now I want to convert them in w =[ca y]=[5 4 1 3] and another w=[ca]=[8 3 2 1] Is their an easy matlab code to do that? I have Matrizes with 5000 columns. Thanks in advance Julia Julia Hof...

substruction of of one column from other column of matrix
Hi, I have to do substruction of of one column from other columns of a big matrix. For example I have 3 column c1,c2 and c3. I have to substract c2 and c3 from c1 and c3 from c2. I can substract one vector from a matrix. But how can I do it for a big matrix? Thank you. Sunipa Som ...

Multiplying each matrix column by a column vector
I remember using a function that multiplied each column (or optionally row) of a matrix by a specific column (or optionally row) vector. It seems impossible to find the function in the MATLAB help since I don't remember the name. Anyone know which one I'm talking about? Thanks, Bryan I don't know of such a particular function; however, for any matrix A and column vector v, it would seem straightforward to accomplish your task with: A.*repmat(v, 1, size(A,2)) There's probably a more elegant/faster way that avoids using repmat, but I forget at the moment how to index matrices...

Outputting multiple SAS files to multiple worksheets
Hi, *********I have an output with an excel file with multiple worksheets, but i want to name the worksheets as ALPHA, BETA and GAMMA instead of DATA1, DATA2 and DATA3. Can somebody help me with this/ or is this possible to do? Thanks, Hari Following is sample code ... >>>>>>>>>>>>>>>>>>>>>>>>>>>>program<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< LIBNAME X1 odbc noprompt="DRIVER=Microsoft Excel Driver (*.xls);...

outputting multiple sas files to multiple worksheets
People, Yesterday this was discussed and I understand most of it. The code as I understand it follows: proc datasets lib = sashelp; libname xlcopy excel "c:\temp\xl-lib.xls"; copy out=xlcopy memtype = data; select class shoes retail; run; libname xlcopy; quit; I have a couple of questions 1 - I think this code is copying SAS files into excel? 2 - Is this sas ver9? 3 - Do we not have to export the data as csv or xls first ? Thanks Dave Dave Fickbohm Use Technology to the Fullest 1250 45th st suite 200 Emeryville, CA, 94608 510 594 4151 voice David, 1.) Yes 2.) I know Howard ...