tables and split file

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

tables and split file

Jan Verbelen
Dear list members,

I'm looking for a solution to a problem regarding organized output by a
split variable, in using the tables command.

I have a file containing 17 000 people with a disability, all clients of
care institutions for disabled people.
All these clients make use of two types of facility: a subsidized package
of day care facilities and a subsidized package of living facilities.
Each client belongs to a institution (each institution has a number) and
each client has a value for both subsidized facility packages.
I want to obtain an output where I can see all tables for each institution
separately.
What I get now when I split the file by institution and then specify the
tables I want, is an output where I get each separate table organized by
institution.
What I want to see is all tables specified for each institution
separately.

This is an example of my syntax:

SORT CASES BY
  institution(A) .
SORT CASES BY institution.
SPLIT FILE
  SEPARATE BY institution.
TABLES
  /FTOTAL $t 'Total'
  /FORMAT BLANK MISSING('.') /TABLES
  (LABELS) + $t BY
  living
  /STATISTICS COUNT ((F5.0) 'Count' )
    CPCT ((F7.1) '%' )  /TITLE  'module living'.
TABLES
  /FTOTAL $t 'Totaal'
  /FORMAT BLANK MISSING('.') /TABLES
  (LABELS) + $t BY
  daycare
  /STATISTICS COUNT ((F5.0) 'Count' )
    CPCT ((F7.1) '%' )  /TITLE  'module day care'.

Is there something I'm overlooking to obtain my goal here?

Many thanks in advance

-----------
Jan Verbelen

Studiecel / L806
Vlaams Agentschap voor  Personen met een Handicap

Study Department / L806
Flemish Agency for  Persons with a Disability

Sterrenkundelaan 30
1210 BRUSSEL

TEL ++32 (0)2 225 86 32
FAX ++32  (0)2 225 84 05

URL http://www.vlafo.be

---------------------------------------------------------------------------------
DISCLAIMER :
De personeelsleden van het agentschap doen hun best om in e-mails
betrouwbare informatie te geven. Toch kan niemand rechten doen gelden op
basis van deze inhoud. Als in de e-mail een stellingname voorkomt, is
dat niet noodzakelijk het standpunt van het agentschap. Rechtsgeldige
beslissingen of officiele standpunten worden alleen per brief toegestuurd.
Reply | Threaded
Open this post in threaded view
|

Re: tables and split file

Raynald Levesque
Hi

One way is to place the tables within a macro like this (untested code):

*///////////////.
DEFINE !mymacro (institutionID=!TOKENS(1))
GET FILE="name and path of data file".
SELECT IF institutionID=!institutionID.
TABLES
  /FTOTAL $t 'Total'
  /FORMAT BLANK MISSING('.') /TABLES
  (LABELS) + $t BY
  living
  /STATISTICS COUNT ((F5.0) 'Count' )
    CPCT ((F7.1) '%' )  /TITLE  !QUOTE(!CONCAT('module living for
InstitutionID ',!InstitutionID)).
TABLES
  /FTOTAL $t 'Totaal'
  /FORMAT BLANK MISSING('.') /TABLES
  (LABELS) + $t BY
  daycare
  /STATISTICS COUNT ((F5.0) 'Count' )
    CPCT ((F7.1) '%' )  /TITLE  'module day care for InstitutionID
',!InstitutionID))'.
!ENDDEFINE.
*///////////////.


!mymacro institutionID=1235.
!mymacro institutionID=2597.
Etc.. Etc...

You can automate the various macro calls using the method illustrated in
example #3 of
http://www.spsstools.net/Macros.htm#MacroVariables

However note that in the above example, the macro argument is a string. If
your id is a number, you will need to modify the code to remove the quotes.

Cheers!

Raynald Levesque [hidden email]
Visit my SPSS site: http://www.spsstools.net


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jan
Verbelen
Sent: October 10, 2006 5:35 AM
To: [hidden email]
Subject: tables and split file

Dear list members,

I'm looking for a solution to a problem regarding organized output by a
split variable, in using the tables command.

I have a file containing 17 000 people with a disability, all clients of
care institutions for disabled people.
All these clients make use of two types of facility: a subsidized package of
day care facilities and a subsidized package of living facilities.
Each client belongs to a institution (each institution has a number) and
each client has a value for both subsidized facility packages.
I want to obtain an output where I can see all tables for each institution
separately.
What I get now when I split the file by institution and then specify the
tables I want, is an output where I get each separate table organized by
institution.
What I want to see is all tables specified for each institution separately.

This is an example of my syntax:

SORT CASES BY
  institution(A) .
SORT CASES BY institution.
SPLIT FILE
  SEPARATE BY institution.
TABLES
  /FTOTAL $t 'Total'
  /FORMAT BLANK MISSING('.') /TABLES
  (LABELS) + $t BY
  living
  /STATISTICS COUNT ((F5.0) 'Count' )
    CPCT ((F7.1) '%' )  /TITLE  'module living'.
TABLES
  /FTOTAL $t 'Totaal'
  /FORMAT BLANK MISSING('.') /TABLES
  (LABELS) + $t BY
  daycare
  /STATISTICS COUNT ((F5.0) 'Count' )
    CPCT ((F7.1) '%' )  /TITLE  'module day care'.

Is there something I'm overlooking to obtain my goal here?

Many thanks in advance

-----------
Jan Verbelen

Studiecel / L806
Vlaams Agentschap voor  Personen met een Handicap

Study Department / L806
Flemish Agency for  Persons with a Disability

Sterrenkundelaan 30
1210 BRUSSEL

TEL ++32 (0)2 225 86 32
FAX ++32  (0)2 225 84 05

URL http://www.vlafo.be

----------------------------------------------------------------------------
-----
DISCLAIMER :
De personeelsleden van het agentschap doen hun best om in e-mails
betrouwbare informatie te geven. Toch kan niemand rechten doen gelden op
basis van deze inhoud. Als in de e-mail een stellingname voorkomt, is dat
niet noodzakelijk het standpunt van het agentschap. Rechtsgeldige
beslissingen of officiele standpunten worden alleen per brief toegestuurd.