## Calculate statistics on data

Solved
Occasional Contributor
Posts: 6

# Calculate statistics on data

[ Edited ]

data d1;

input number 11.;

cards;

12345678902

12345

98441234567

888

12349844561 ;

run;

I do have this data set.

now i want to get the percentage of dataset according to width of observation.

Like i do have 3 observation having width of 11 then i want to see them as 50% in variable x and rest of the 50% in y.

Accepted Solutions
Solution
‎06-14-2017 04:36 AM
Super User
Posts: 10,209

## Re: Calculate statistics on data

Try

``````data d2;
set d1;
n_l = length(strip(put(number,best.)));
run;

proc freq data=d2;
tables n_l;
run;``````
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code

All Replies
Solution
‎06-14-2017 04:36 AM
Super User
Posts: 10,209

## Re: Calculate statistics on data

Try

``````data d2;
set d1;
n_l = length(strip(put(number,best.)));
run;

proc freq data=d2;
tables n_l;
run;``````
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
☑ This topic is solved.