Text mining and content categorization

Middle Observation

Reply
Contributor
Posts: 21

Middle Observation

For the given data set with uneven number of observations, either character or numeric, how can I find and display the middle observation?

 

Thank you greatly :-)

Super User
Posts: 18,549

Re: Middle Observation

Sample data and expected output. In the post rather than an attachment or image. 

Contributor
Posts: 21

Re: Middle Observation

I am a bit confused...  I know how to find the middle number in a numerical data set, however if I decide to use character variables, I am getting missing values in output.

Thank you.

Respected Advisor
Posts: 4,747

Re: Middle Observation

Use nobs= to get the number of obs. Get the mid obs with point= option :

 

data test;
do txt = "abc","def","ghi","jkl","mno";
    output;
    end;
run;

data mid;
if 0 then set test nobs=n;
n = ceil(n/2);
set test point=n;
output;
stop;
run;
PG
Contributor
Posts: 21

Re: Middle Observation

Thank you. That works.
Ask a Question
Discussion stats
  • 4 replies
  • 507 views
  • 1 like
  • 3 in conversation