Desktop productivity for business analysts and programmers

Asking the experts / transfering data from one dataset to another?

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 111
Accepted Solution

Asking the experts / transfering data from one dataset to another?

Hello,

 

I have an existing dataset with five variables (5 columns)

 

Three of those columns are already filled up with data.

 

If I have the data for the two empty columns in another dataset, how can we transfer the data from one dataset to the other without using a join or macro value in the case we don't have a key to do a by statement?

 

Suppose that the values of var2 (numeric) and those of var5 (characters) are in another dataset by that there is not sustainable key to make the join.  Please note that the incomplete dataset may have only few observations, let's say, not more than 10.

 

How can we do that task?

Regards,

Alain

 

Ex:

 

 

var1     var2      var3    var4    var5

AN1      1                       AP

AN2      6                       AD

AN3      8                       EP    


Accepted Solutions
Solution
‎02-14-2018 10:32 AM
Super User
Super User
Posts: 9,211

Re: Asking the experts / transfering data from one dataset to another?

Provide an example, how do you know where the observations go.  Can that be translated into any logical sense?  If you know the position, then add a variable into both datasets, and manually input that position into the datasets, then merge on that id.  Its impossible to answer a question like: "I have some data, I know it, you fix it for me".

View solution in original post


All Replies
Super User
Super User
Posts: 9,211

Re: Asking the experts / transfering data from one dataset to another?

Sorry the question is nonsense.  If there is no link between table 1 and table 2 how do you, using any process known to man, expect to put one into the other?  There has to be some sort of link between data, even if that link is only logical record position in the data.  Also, post clear test data in the form of a datastep and show what the output should look like, this would clearly show what you require.

Frequent Contributor
Posts: 111

Re: Asking the experts / transfering data from one dataset to another?

I agree with you but imagine that you don't have any key to make the join but you know the position of the values you want to pick from dataset1 and you know the position where the values should go in dataset2.

 

I will never do that for a large dataset but what can we do in the case we have few values to transfert.

Super User
Posts: 6,542

Re: Asking the experts / transfering data from one dataset to another?

To get a solution,  you really need to describe what you want in a little more detail.

 

Do both data sets contain the same number of observations?

 

If so, do you want to match them up (first observation in one data set, matching first observation in the other data set, etc.)?

 

If not, how do you want to match them up?

 

You illustrated the first data set.  Now illustrate the second one, and show the result that you would like to achieve.

Frequent Contributor
Posts: 111

Re: Asking the experts / transfering data from one dataset to another?

Posted in reply to Astounding

The second dataset may look like that

 

17 15
20 21
16 17

 

The values of the first column (dataset2) goes in var3 (dataset1) and the values of the second column (dataset2) goes in var5 (dataset1) .

Consider the possibility that the second line (dataset2) is selected first (to go at the first line in dataset1) then the first line (dataset2) go at the second line of dataset1 and  finally the last line of dataset2 goes at the end of dataset1.

 

I am looking for a solution but only with very small dataset (max observations = 10 and few variables)

 

 

 

Solution
‎02-14-2018 10:32 AM
Super User
Super User
Posts: 9,211

Re: Asking the experts / transfering data from one dataset to another?

Provide an example, how do you know where the observations go.  Can that be translated into any logical sense?  If you know the position, then add a variable into both datasets, and manually input that position into the datasets, then merge on that id.  Its impossible to answer a question like: "I have some data, I know it, you fix it for me".

Super User
Posts: 13,066

Re: Asking the experts / transfering data from one dataset to another?

Provide 2 input data sets in the form of datasteps and what the result for those two should be.

 

From what you have provided so far we don't even know the types of variables involved. It may well be that the variables in data set 2 are character and cannot be placed into the numeric variables in data set 1 without manipulation.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 145 views
  • 1 like
  • 4 in conversation