06-25-2015 10:51 AM
Sorry in advance if this is a silly question. But how do I combine 2 columns from two different SAS files? I tried query building, but query builder created a SAS file with two seperate columns and I want these two columns combine into one column instead. Am I using the wrong tool or is there another way to join.
Thanks in advance.
06-25-2015 10:56 AM
I think it would make it easier for us to help you out if you provided some example data in the two data sets you want to combine, and then a brief example of the output you're looking to achieve. Dummy data can be used, just so we understand the structure of the two data sets and the desired output you are wanting. Thanks!
06-25-2015 10:58 AM
Provide some examples of the 2 input data sets and what you want the output to look like. There are several ways to interpret "combine 2 columns" and details will help. Also let us know, if there is possible confusion, if a variable that looks numeric is actually a character variable.
06-25-2015 11:14 AM
If you are using enterprise guide query builder, you need to define a calculated column, where you need to specify an expression how you wish to combine the column values.
06-25-2015 02:32 PM
So, it is actually really simple. I have two SAS data files.
I want to combined then to one that looks like this.
File 1 has a bunch of text, file 2 has a bunch of text. I want them in one column. However, I am currently getting them in two columns when running query builder with outer joint function.
Thanks for your help.
06-25-2015 05:49 PM
So to combine two tables without matching the rows you can use the SET statement in SAS.
set a b ;
Or if you have some ID variables that the two datasets are sorted on you can use a BY statement to insure that the generated table is also sorted.
set a b ;
by id ;
06-25-2015 03:08 PM
You could try an insert into statement:
insert into table_1
(column1, column2, column3)
select column1, column2, column3
If there is a specific subset from table_2, you can use a where statement after the from statement such as