Hi SAS users,
thank you for taking your time.
I have the dataset "Data1", with a structure like this:
And I have the Dataset "Sum1", which looks like this:
I would like to merge those two so that for every row in data set "Data1" the corresponding values of variables sum1 and n from Dataset "Sum1" show up if the Jahr=Jahr and if ICBSUC=ICBSUC
So for example for every observation in data set "Data1" which in from Jahr 2010 and has an industry code ICBSUC of 10101010 the value in the variable sum1 should be 1.173... and the value in variable n should be 19.
my current code looks like this:
I believe the code what you wrote is correct, a minor update to include if in1 and in2 as below
data Data2;
merge Data1(in=in1) sum1 (in =in2);
by Jahr icbsuc;
if in1 and in2;
run;
I believe the code what you wrote is correct, a minor update to include if in1 and in2 as below
data Data2;
merge Data1(in=in1) sum1 (in =in2);
by Jahr icbsuc;
if in1 and in2;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.