logo_learn_stats

Learn how to Carry out an Internal Secured in SAS (With Instance)

Posted on
banner 336x280

You’ll usefulness refer to modest syntax to accomplish an internal attach with two datasets in SAS:

proc sql;
    assemble desk final_table as
    choose * from data1 as x attach data2 as y
    on x.ID = y.ID;
abandon;

Please see instance presentations find out how to usefulness this syntax in follow.

banner 468x60

Homogeneous: Learn how to Carry out a Left Secured in SAS

Instance: Internal Secured in SAS

Assume now we have refer to two datasets in SAS:

/*assemble datasets*/
information data1;
    enter staff $ issues;
    datalines;
Mavs 99
Spurs 93
Rockets 88
Thunder 91
Warriors 104
Cavs 93
Nets 90
Hawks 91
;
run;

information data2;
    enter staff $ rebounds;
    datalines;
Mavs 21
Spurs 18
Warriors 27
Hawks 29
Knicks 40
Raptors 30
;
run;

/*view datasets*/
proc print information=data1;
proc print information=data2;

Understand that the 2 datasets percentage one variable in habitual: staff.

We will be able to usefulness refer to syntax to accomplish an internal attach and assemble a unused dataset that comprises simplest the rows through which the staff variable presentations up in each datasets:

/*carry out internal attach*/
proc sql;
	assemble desk final_table as
	choose * from data1 as x attach data2 as y
	on x.staff = y.staff;
abandon;

/*view result of internal attach*/
proc print information=final_table;

The ensuing dataset comprises simplest the rows through which the staff variable seemed in each datasets.

When you the following the 2 datasets from previous, you’ll realize that there are simplest 4 groups that seem in each datasets: Mavs, Spurs, Warriors, and Hawks.

Since we selected to attach the 2 datasets at the staff variable, those are the 4 groups that still seem within the ultimate dataset.

Supplementary Assets

Please see tutorials provide an explanation for find out how to carry out alternative habitual duties in SAS:

Learn how to Normalize Knowledge in SAS
Learn how to Exchange Characters in a Fibre in SAS
Learn how to Exchange Lacking Values with 0 in SAS
Learn how to Take away Duplicates in SAS

banner 336x280

Leave a Reply

Your email address will not be published. Required fields are marked *