DATA Step, Macro, Functions and more

Calculate statistics on data

Accepted Solution Solved
Reply
Established User
Posts: 1
Accepted Solution

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: 6,936

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

View solution in original post


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

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
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 141 views
  • 2 likes
  • 2 in conversation