Help using Base SAS procedures

Determine odd/even numbers

Reply
Occasional Contributor
Posts: 11

Determine odd/even numbers

I need to create a dataset of only odd account numbers from a larger data set. Any suggestions?
Super Contributor
Super Contributor
Posts: 365

Re: Determine odd/even numbers

Hello Acaims,

A possible solution:
[pre]
data r;
set i;
if MOD(AccountNo,2)=1 then output;
run;
[/pre]

Sincerely,
SPR
Occasional Contributor
Posts: 11

Re: Determine odd/even numbers

Thank you!!! That worked great!
Regular Contributor
Posts: 171

Re: Determine odd/even numbers

Consider using the mod function. Assuming there is an integer variable in your dataset called ACCOUNT, odd numbered accounts could be selected with the following where statement.
[pre]
where mod(account, 2)=1;
[/pre]
Ask a Question
Discussion stats
  • 3 replies
  • 3232 views
  • 0 likes
  • 3 in conversation