BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
No-body
Fluorite | Level 6

Hello;

 

I have a variable in a data called numbers and in the variable there are a set with numbers in it - lets say 1 to 9000. 
I need to find any numbers that are not in the sequence - how do I do that?

 

Thanks 

1 ACCEPTED SOLUTION

Accepted Solutions
No-body
Fluorite | Level 6

This was my idea then merge but is not working.

data verify;

set test;

 

do var = min(1) to max(9000); output;
end; drop min max; run;


data test1;
merge verify test; by number;
proc freq; data=test;
run;

View solution in original post

7 REPLIES 7
Reeza
Super User
Merge it with a set of data that is the full series and anything not in the range will be identified.
No-body
Fluorite | Level 6

This was my idea then merge but is not working.

data verify;

set test;

 

do var = min(1) to max(9000); output;
end; drop min max; run;


data test1;
merge verify test; by number;
proc freq; data=test;
run;

No-body
Fluorite | Level 6
Sorry I ment to say proc freq; data = test1
Reeza
Super User

Your log is probably full of errors because that's not valid code. This should get you started:

 

*generate verification data set;
data verify;
flag=1;
do number= 1 to 9000;
output;
end;
run;


*use IN data set options to identify where a record is coming from or use flag;
data test;
merge verify (in=t1) test (in=t2);
by number;
missing=0;
if t1 and not t2 then missing=1;
run;

No-body
Fluorite | Level 6
Thanks for you help.
Reeza
Super User
Your answer isn't correct so marking that as the answer isn't right.
No-body
Fluorite | Level 6
My apologizes I thought I marked what you gave me, I am new to this so still figuring it out.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 7 replies
  • 739 views
  • 1 like
  • 2 in conversation