Help using Base SAS procedures

Couting no of character and Numerics in a Observation

Reply
Regular Contributor
Posts: 229

Couting no of character and Numerics in a Observation

Data x;
input name $;
cards;
company127there
34look67init
name3456745
run;

I want the count of character and numerics in the name variable.
Respected Advisor
Posts: 3,799

Re: Couting no of character and Numerics in a Observation

[pre]
Data x;
input name :$20.;
cCount=lengthN(compress(name,,'KA'));
nCount=lengthN(compress(name,,'KD'));
cards;
company127there
34look67init
name3456745
JustALpha
22
;;;;
run;
proc print;
run;
[/pre]
Ask a Question
Discussion stats
  • 1 reply
  • 106 views
  • 0 likes
  • 2 in conversation