User Defined Function In SPSS

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

User Defined Function In SPSS

GauravSrivastava
Hi List,

I wanted to create some user defined function in which I want to define my syntax and need to pass only varibale name everytime to run the synatx. For example: I have to run number of custom tables. below is my custom table syntax,red highlighted part only will change and rest of them will be same. Can anyone help me on this:

CTABLES.docx

CTABLES
  /FORMAT EMPTY='-' MISSING='.'
  /SMISSING VARIABLE
  /VLABELS VARIABLES=Q1 Age_s DISPLAY=NONE  /VLABELS VARIABLES=Age_gr Maritalstatus_gr Income_gr DISPLAY=LABEL
  /TABLE Q1 [C][COUNT F40.0] + Age_s [S][COUNT 'Sigma' F40.0, MEAN, STDDEV, SEMEAN] BY Age_gr [C] + Maritalstatus_gr [C] + Income_gr [C]
  /SLABELS POSITION=ROW
  /CATEGORIES VARIABLES=Q1 [SUBTOTAL='20-34 (Net)', 2, 3, 4, SUBTOTAL='35-49 (Net)', 5, 6, 7,
    SUBTOTAL='50-60 (Net)', 8, 9, OTHERNM] EMPTY=INCLUDE POSITION=BEFORE
  /CATEGORIES VARIABLES=Age_gr ORDER=A KEY=VALUE EMPTY=INCLUDE TOTAL=YES POSITION=BEFORE
  /CATEGORIES VARIABLES=Maritalstatus_gr Income_gr ORDER=A KEY=VALUE EMPTY=INCLUDE
  /COMPARETEST TYPE=MEAN ALPHA=0.05 ORIGIN=COLUMN INCLUDEMRSETS=YES
    CATEGORIES=ALLVISIBLE MEANSVARIANCE=ALLCATS
  /COMPARETEST TYPE=PROP ALPHA=0.05 ORIGIN=COLUMN INCLUDEMRSETS=YES
    CATEGORIES=ALLVISIBLE
  /TITLES
    TITLE='Q1. Please select your age.'.

CTABLES
  /FORMAT EMPTY='-' MISSING='.'
  /SMISSING VARIABLE
  /VLABELS VARIABLES=Q2 Income_s DISPLAY=NONE  /VLABELS VARIABLES=Age_gr Maritalstatus_gr Income_gr
    DISPLAY=LABEL
  /TABLE Q2 [COUNT F40.0] + Income_s [COUNT 'Sigma' F40.0, MEAN, STDDEV, SEMEAN] BY Age_gr [C] +
    Maritalstatus_gr [C] + Income_gr [C]
  /SLABELS POSITION=ROW VISIBLE=NO
  /CATEGORIES VARIABLES=Q2 [SUBTOTAL='< $50 K/Yr (net)', 1, 2, 3, 4, SUBTOTAL='$50 - <$100 K/Yr '+ '(net)', 5, 6, 7, 8, SUBTOTAL='$100 K+/Yr (net)', 9, 10, 11, 12, OTHERNM] EMPTY=INCLUDE
    POSITION=BEFORE
  /CATEGORIES VARIABLES=Age_gr ORDER=A KEY=VALUE EMPTY=INCLUDE TOTAL=YES POSITION=BEFORE
  /CATEGORIES VARIABLES=Maritalstatus_gr Income_gr ORDER=A KEY=VALUE EMPTY=INCLUDE
  /COMPARETEST TYPE=MEAN ALPHA=0.05 ORIGIN=COLUMN INCLUDEMRSETS=YES
    CATEGORIES=ALLVISIBLE MEANSVARIANCE=ALLCATS
  /COMPARETEST TYPE=PROP ALPHA=0.05 ORIGIN=COLUMN INCLUDEMRSETS=YES
    CATEGORIES=ALLVISIBLE
  /TITLES
    TITLE='Q2. Please select your household income before tax.'.

Reply | Threaded
Open this post in threaded view
|

Automatic reply: User Defined Function In SPSS

Sarraf, Shimon Aaron


I am currently out of the office and will return Monday, May 21. I will respond to your e-mail upon my return. If you need immediate assistance, please call 812-856-5824.

Thank you,

 

Shimon Sarraf

Center for Postsecondary Research

Indiana University Bloomington

Reply | Threaded
Open this post in threaded view
|

Re: User Defined Function In SPSS

David Marso
Administrator
In reply to this post by GauravSrivastava
SPSS has a Macro functionality.  Look at DEFINE-!ENDDEFINE in the manual.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Automatic reply: User Defined Function In SPSS

Darya McClain
Hello, I'm on leave until August 15th. I will reply to your message when I return.
 
Thank you, Darya
 
Darya McClain, PhD
Research Associate Professor
College of Nursing and Health Innovation
Arizona State University
500 N. 3rd Street
Phoenix, AZ 85004
(602)496-0824
Dream ~ Discover ~ Deliver