BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi i have 3 datasets a,b,c and the names for dataset A=cus_name and in dataset B the name is F_name and in datset C the name is l_name now i want to create a dataset D and set all the three datasets .But i wnat to keep a condition like if cus_name,F_name and l_name then the name of the variable should be made to final_name in the final dataset D.and all the three variable obs should come in to the variable as final_name .The observations are different in all three datasets.(without using rename or label)



data a;
input cus_name$;
cards;
nani
run;


data b;
input f_name$;
cards;
rani
run;


data c;
input l_name$;
cards;
raju
run;


output

final_name

nani
rani
raju
4 REPLIES 4
deleted_user
Not applicable
Hi,

Please try this..
I didn't get your requirement.
I tried with what i have understood

data d(drop=cus_name f_name l_name);
set a b c;
final=COALESCEC(cus_name,f_name,l_name);
run;

Regrds,
skm
deleted_user
Not applicable
Hi,
You can try the following:

data D;
set a(rename = (cus_name = Final_Name)
b(rename = (f_name = Final_Name)
c(rename = (l_name = Final_Name)
run;
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The post describes a "data interleave" technique, not a "data merge" requirement? I really don't understand why you would want to create an output file having observations where any one contributing variable name will be blank -- that will be the behavior result when using SET instead of considering somehow doing a MERGE (however you would need to have some BY variable list to use with a merge process.

Honestly, the purpose of this example, as described in your post, appears somewhat curious, given that you have mentioned "set", even though you really mean to do some type of merge, right?

I'm a bit baffled how this point wasn't raised previously with the post/thread, frankly.

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
I haven't used merge because in the example given, I couldn't find any common key. And the output which is required is 3 rows instead of 1 row.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 693 views
  • 0 likes
  • 2 in conversation