BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
NewUsrStat
Lapis Lazuli | Level 10

Hi guys, 

suppose to run a proc freq with an output that looks like this: 

 

  ID     Freq    Perc     ..

0001    .....      .....

0002    .....      .....

0008    .....      .....

0005    .....      .....

.......     .....      .....         

 

Suppose also to have a data set that looks like this: 

 

  ID     Value1    Value2    ..

0001    .....      .....

0002    .....      .....

0003    .....      .....

0004    .....      .....

.......     .....      .....          

 

 

Is there a way to remove from the data set the IDs that appear in proc freq output? 

Desired output: 

 

ID     Value1    Value2    ..

0003    .....      .....

0004    .....      .....

.......     .....      .....          

 

Thank you in advance

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

UNTESTED CODE (because you haven't given us actual data to work with)

 

This assumes both data sets are sorted by ID

 

data want;
    merge dataset2(in=in2) dataset1(in=in1);
    by id;
    if in2 and not in1;
    drop freq perc;
run;

 

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

UNTESTED CODE (because you haven't given us actual data to work with)

 

This assumes both data sets are sorted by ID

 

data want;
    merge dataset2(in=in2) dataset1(in=in1);
    by id;
    if in2 and not in1;
    drop freq perc;
run;

 

--
Paige Miller
NewUsrStat
Lapis Lazuli | Level 10
Thank you very much!
It works perfectly.

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 606 views
  • 1 like
  • 2 in conversation