Merge two variables

Hi,

I am looking for a solution to the following problem. I have two String Arrays that I want to combine into a third.

let string no1  = {a, b, c, d, e };

let string no2 = {b Col1, d Col2, e Col3} ;

no1

A
B
C
D
E

no2

B             COL1
D             COL2
E             COL3

And the wanted result:

no3

A                .
B             COL1
C                .
D             COL2
E             COL3

I hope someone can provide a simple solution 🙂

Peter

1 Answer



0



The GAUSS function outerJoin does exactly what you want. However, as of the writing of this answer, it does not work for string arrays. However, I think this code below will do exactly what you want:

new;
cls;

string no1  = { "a", "b", "c", "d", "e" };

string no2 = { "b" "Col1",
    "d" "Col2",
    "e" "Col3"};

print outerJoinSA(no1, 1, no2, 1);

proc (1) = outerJoinSA(a, ca, b, cb);
    retp(cvtosa(outerJoin(satocv(no1), 1, satocv(no2), 1)));
endp;

aptech

1,773

Your Answer

1 Answer

0

The GAUSS function outerJoin does exactly what you want. However, as of the writing of this answer, it does not work for string arrays. However, I think this code below will do exactly what you want:

new;
cls;

string no1  = { "a", "b", "c", "d", "e" };

string no2 = { "b" "Col1",
    "d" "Col2",
    "e" "Col3"};

print outerJoinSA(no1, 1, no2, 1);

proc (1) = outerJoinSA(a, ca, b, cb);
    retp(cvtosa(outerJoin(satocv(no1), 1, satocv(no2), 1)));
endp;


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy