count number of cases for multiple categories

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

hadieroel
Posts: 2
Joined: Sat Jul 21, 2012 5:52 pm

count number of cases for multiple categories

Postby hadieroel » Mon Aug 13, 2012 7:54 am

I have a question and i cant find the answer nowhere.

I've a datafile in which every row is a observation. Each observation is done on a specific date. So for example on 1 specific date i have 3 observation, and for another observation i have 23 observations. Each date has a different number of observations.

I now want to create a new variable which provides me for each date the number of observations on that date.

Does somebody know how to do that is just a few lines of syntax!? I thought it had something to do with count and loops but i can figure it out!

I need a sort syntax instead of a

Code: Select all

if datum_num =20110222 n_datum = 2.
line for each date. (i have several hunderds of dates)

Please help me!
Penguin_Knight
Posts: 473
Joined: Thu Apr 05, 2012 5:58 pm

Re: count number of cases for multiple categories

Postby Penguin_Knight » Mon Aug 13, 2012 12:40 pm

Code: Select all

AGGREGATE
  /OUTFILE=* MODE=ADDVARIABLES OVERWRITEVARS=YES
  /BREAK=datum_num
  /n_datnum=N.

Who is online

Users browsing this forum: No registered users and 2 guests

cron