Thursday, 10 May 2007

Simple Macro

SPSS provides the capability to create macros that contain text and SPSS command syntax. Macros can perform the same command repeatedly, combine several procedures, or calculate user-defined statistics. Any functions you can perform using SPSS syntax can be incorporated into a macro. When a macro is called, it is expanded so that any text including commands will be used in its place.

Simple macro that differs between nominal, ordinal and scale variables and when you run this macro, it gives different statistics to specific variable type.

DEFINE !sumstat (catvars = !CHAREND('/')
/scalevars = !CMDEND)
!IF (!catvars ~=!NULL) !THEN
frequencies variables = !catvars
!IF (!scalevars ~= !NULL) !THEN
frequencies variables = !scalevars
/format = notable
/statistics = mean median min max

To run this macro use:
!sumstat catvars = gender opinion1
/scalevars = age salary.

When you run the last chunk of this code you will get in output window for nominal/ordinal variables different statistics and barchart, whereas for scale variables you will get statistics as mean, median, min, max and histogram.

If it seems to complicated, you can still use this :-)

Freq all.


Amit said...

Excellent post.I want to thank you for this informative read, I really appreciate sharing this great post. Keep up your

mba india

gethqnet said...

Thanks for such a great post and the review, I am totally impressed! Keep stuff like this coming.
Michael Jackson

Anonymous said...

The Hogan
cost us so much, and We can run a “full cycle” of seasonally appropriate shoes before I wear Hogan scarpe uomo
shoes. You just have to wear them with the women’s knee Hogan uomo
. Consider the rest of the jeans with women’s knee hogan donna
as well though.

Anonymous said...

Burning the audio and video data to the appropriate disc format - either CD or DARIA
. Authoring a DARIA DVD
requires converting all video and audio sources into MPEG-2 forma. Converting many files to create a DARIA DVD COLLECTION

ugg women said...

Well worth to read this article, thanks for sharing this information. With this article you offered me got a chance to know about this, anyway i say Great Article! and waiting for you next article about this interesting subject.

Cheap jordan said...

[url=] air Jordan shoes,air Jordan max,free shipping[/url]
[b][url=]air max 2009,air max 2009 shoes[/url][/b]
[url=]cheap designer handbags,
wholesale designer handbags online,50% off[/url]