|
Data Have ;
Infile Cards ;
Input Var $10. ;
Cards ;
54A8
1234
58932
320482390
123abx77s
4323
3243
;
Run ;
Data Need ;
Set Have ;
Where PrxMatch( '/^\d{4}$/O' , Strip(Var) ) ;
Run ;
Proc Print
Data = Need ;
Run ;
Toby Dunn
"Don't bail. The best gold is at the bottom of barrels of crap."
Randy Pausch
"Be prepared. Luck is where preparation meets opportunity."
Randy Pausch
> Date: Thu, 12 Jun 2008 12:25:11 -0700
> From: ledaniels7@GMAIL.COM
> Subject: Keep records with a specific number of digits
> To: SAS-L@LISTSERV.UGA.EDU
>
> Could someone tell me how I can keep only the records that have a
> certain number of digits?
>
> Example:
> Variable
> 5468
> 58932
> 320482390
> 4323
> 3243
>
> I am looking to keep only the records with 4 digits, so I only want 3
> records - 5468, 4323, 3243.
_________________________________________________________________
It’s easy to add contacts from Facebook and other social sites through Windows Live™ Messenger. Learn how.
https://www.invite2messenger.net/im/?source=TXT_EML_WLH_LearnHow
|