max - SPSS - How to isolate the maximum value in a variable so you can use it in syntax? -


i have table of areas data. particular operation, want exclude top , bottom 1% of areas, include extreme outliers.

seems me way forward is:

sort cases thevariableiwanttoanalyse  (a) . numeric id (f12.0) .  * create casenum label "id" compute id = $casenum. * populate casenum execute. numeric idmax (f12.4) .   * create variable contain highest value "id"  numeric id1perc (f12.4) . * create variable contain 1% of highest value "id"   compute idmax = max(id) .    * determine highest value id. 'mock-syntax' line not work.    compute id1perc = idmax / 100 . * 1% of highest value "id"   select cases id >= id1perc or id <= idmax - id1perc . 

draw graphs etc. need

sort cases thenextvariableiwanttoanalyse  (a) . compute id = $casenum. * populate new casenum order execute. 

etc ...

try filter out top , bottom 1% - add filter filter. turn off extreme cases, or select if filter. ... execute. delete them

edit: note repeated values condensed rank method (specifically /tiesoption). might not ideal if have possibility of repeated values. change /ties option if that's case.

************* generate random data *****************. input program. -       loop #i = 1 1000. -             compute y = rv.normal(100,10). -           end case. -       end loop. -       end file. end input program.  dataset name exampledata window=front. execute.   ************* rank data  *************. dataset activate exampledata. rank variables=y (a)   /rfraction fractile   /ties=condense.  ************* make filter  *************. compute filter = (fractile>0.01 , fractile < 0.99). execute.  * chart builder. ggraph   /graphdataset name="graphdataset" variables=y filter missing=listwise reportmissing=no   /graphspec source=inline. begin gpl   source: s=usersource(id("graphdataset"))   data: y=col(source(s), name("y"))   data: filter=col(source(s), name("filter"), unit.category())   guide: axis(dim(1), label("y"))   guide: axis(dim(2), label("frequency"))   guide: legend(aesthetic(aesthetic.color.interior), label("filter"))   element: interval.stack(position(summary.count(bin.rect(y))), color.interior(filter),      shape.interior(shape.square)) end gpl. 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -