Sas 9.4
HI,
So I have 2 data set. Data set A has 4000 observations and Data set B has 3000 observations. I know that B is a subset of A but I do not know which observations are in B. How can I have SAS print the 1000 observations that are only in A?
Thanks in advance.
@ajb wrote:
Is there a line of code I could use to output the results to a new data set?
Yes there is: CREATE TABLE AS. Eg.
proc sql;
create table want as
select * from A
EXCEPT
select * from B;
quit;
Regards,
- Jan.
Easiliy done in SQL:
proc sql;
select * from A
EXCEPT
select * from B;
quit;
Hope this helps,
- Jan.
This would work, I think
proc sort data=a; by _all_; run;
proc sort data=b; by _all_; run;
data aMinusb;
merge a b(in=inb);
by _all_;
if not inb;
run;
proc print data=aMinusb; run;
@ajb wrote:
Is there a line of code I could use to output the results to a new data set?
Yes there is: CREATE TABLE AS. Eg.
proc sql;
create table want as
select * from A
EXCEPT
select * from B;
quit;
Regards,
- Jan.
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.
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.