BookmarkSubscribeRSS Feed
Naveen1
Calcite | Level 5
 
12 REPLIES 12
LinusH
Tourmaline | Level 20
And what is the rule for imputation?
Can't really see that id is something you can impute...?
Data never sleeps
Naveen1
Calcite | Level 5
By I'd I have to impute. If I do right merge blanks will come(ref:table2 )
instead blanks I want table 1 values.
LinusH
Tourmaline | Level 20
Well you need some kind of rule unless you are happy with randomly assigning of values, which in my mind makes the data useless.
Data never sleeps
Naveen1
Calcite | Level 5
Let's consider only I'd variable from both the tables. If I do right merge
then I will get complete right table(ref: table 2) alons with blanks. But
instead of blanks iam looking values of table 1 (assumption: both the table
has same values).
Patrick
Opal | Level 21

@Naveen1

Let's assume your table1 would also have an ID of 10. Which row/value from the existing table2 would you pick? And why?

Reeza
Super User

table1;                                        

 

Id weight
1 22
2 18
3 23
4 19
5 12
6 20
7 22
8 20
9 12

 

table 2:

Id height
. 76
. 45
. 23
9 11
8 12
4 89
3 43
2 66
1 34

 

Code I have used is, 

data table3;
merge table1(in=x) table2(in=y);
by id;
IF y;
run;

 

my output expectation is :

Id height weight
5 76 12 <- What was the rule for this? 
6 45 20
7 23 22
9 11 12
8 12 20
4 89 19
3 43 23
2 66 18
1 34 22
 

 

 


How did you decide that the first record in Table 2 would be ID 5?

 

Naveen1
Calcite | Level 5
It's just assumption (that is how I was expecting output). My question is
to replace missing values by using merge statement (u can ignore height and
weight variable) consider only I'd variable.
Kurt_Bremser
Super User

On which rule is your assumption based? Without a rule, there will be no programmatic solution, and you can use a random generator or just throw the dice.

Reeza
Super User

@Naveen1 wrote:
It's just assumption (that is how I was expecting output).


We're not in your head. We see only exactly what you post. A computer can only do what you tell it. So what are you telling it to do? 

As someone else stated earlier, you need rules to turn into coded logic. Right now it just seems random, so is that ok randomly assigning the values? Is it ok to have the following output? If not, how do *I*, not you, know it's wrong? Is there a rule. If the rule is only in your head, the only solution is to literally type out each rule manually. 

Is this output ok?

 

Id height weight
5 23 12
6 45 20
7 76 22
9 11 12
8 12 20
4 89 19
3 43 23
2 66 18
1 34 22

 

Tom
Super User Tom
Super User

Why did you match ID=., HEIGHT=76 with ID=5, WEIGHT=12 instead of matching it to one of the other weight records there were not in the height file? ID=6 or ID=7?

Naveen1
Calcite | Level 5

no need of solution, it has some mistake in the question

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 12 replies
  • 1014 views
  • 0 likes
  • 6 in conversation