Question about formatting Summarize output

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

Question about formatting Summarize output

Jeff6610

 

Hello everyone,

 

I have survey data and need to print/output a number of the survey participant’s selected survey answers one case at a time so that interviewers conducting follow-up interviews will have a list of several (but not all) of the participants’ answers.

 

The syntax below comes close, but I get a table (similar to below) with the answers horizontally and when I add more variables I’ll run out of room on the page.

 

Instead, I need to format the output so that my list of selected variable names and answers runs vertically with one variable and the corresponding answer/value for one participant is on each row of output.

 

I’ll eventually want to write some type of macro or loop or similar to handle more than a single case number at a time.

 

How might I accomplish this?

 

Thanks in advance,

 

Jeff

 

 

Temporary.

Select If ($CaseNum = 1).

SUMMARIZE

  /TABLES=Sex Age Race Nativity

  /FORMAT=VALIDLIST  NOTOTAL LIMIT=1

  /TITLE='Sex Age Race'

  /MISSING=VARIABLE

/Cells = None .

 

                                                               

Case Number     Sex         Age                  Race                                                       Nativity

6                         Female     20           Caucasian/White              Foreign born / Born overseas

a Limited to first 1 cases.                                                                             

 

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Question about formatting Summarize output

Mike
I think you want something like the output from the old Tables procedure.
Here is an example that uses split files to get the variable info for all caes.
Assume sub.id is a unique subject identifier.

split file by sub.id.
tables /table=sub.id + sex + age + race + Nativity/
  statistics=count( sub.id,sex,age,race,Nativity).
split file off.

It has been a while since I used this procedure and it may be possible
to get output more to your liking (e.g., "count" might not be needed).

-Mike Palij
New York University
[hidden email]
 

On Wed, May 16, 2018 at 5:01 PM, Jeff <[hidden email]> wrote:

 

Hello everyone,

 

I have survey data and need to print/output a number of the survey participant’s selected survey answers one case at a time so that interviewers conducting follow-up interviews will have a list of several (but not all) of the participants’ answers.

 

The syntax below comes close, but I get a table (similar to below) with the answers horizontally and when I add more variables I’ll run out of room on the page.

 

Instead, I need to format the output so that my list of selected variable names and answers runs vertically with one variable and the corresponding answer/value for one participant is on each row of output.

 

I’ll eventually want to write some type of macro or loop or similar to handle more than a single case number at a time.

 

How might I accomplish this?

 

Thanks in advance,

 

Jeff

 

 

Temporary.

Select If ($CaseNum = 1).

SUMMARIZE

  /TABLES=Sex Age Race Nativity

  /FORMAT=VALIDLIST  NOTOTAL LIMIT=1

  /TITLE='Sex Age Race'

  /MISSING=VARIABLE

/Cells = None .

 

                                                               

Case Number     Sex         Age                  Race                                                       Nativity

6                         Female     20           Caucasian/White              Foreign born / Born overseas

a Limited to first 1 cases.                                                                             

 

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Question about formatting Summarize output

Jon Peck
In reply to this post by Jeff6610
I think the PRINT command might be what you want.  For example,
print /"ID:" id
/"salary:" salary
/"education:" educ/.
exec.

would produce output like this.
ID:   1
salary: $57,000
education:15

ID:   2
salary: $40,200
education:16

ID:   3
salary: $21,450
education:12

You can control the format, and the output can be written directly to a file.  PRINT EJECT would cause each case to be written to a new page.

See the CSR for full details.

On Wed, May 16, 2018 at 3:01 PM, Jeff <[hidden email]> wrote:

 

Hello everyone,

 

I have survey data and need to print/output a number of the survey participant’s selected survey answers one case at a time so that interviewers conducting follow-up interviews will have a list of several (but not all) of the participants’ answers.

 

The syntax below comes close, but I get a table (similar to below) with the answers horizontally and when I add more variables I’ll run out of room on the page.

 

Instead, I need to format the output so that my list of selected variable names and answers runs vertically with one variable and the corresponding answer/value for one participant is on each row of output.

 

I’ll eventually want to write some type of macro or loop or similar to handle more than a single case number at a time.

 

How might I accomplish this?

 

Thanks in advance,

 

Jeff

 

 

Temporary.

Select If ($CaseNum = 1).

SUMMARIZE

  /TABLES=Sex Age Race Nativity

  /FORMAT=VALIDLIST  NOTOTAL LIMIT=1

  /TITLE='Sex Age Race'

  /MISSING=VARIABLE

/Cells = None .

 

                                                               

Case Number     Sex         Age                  Race                                                       Nativity

6                         Female     20           Caucasian/White              Foreign born / Born overseas

a Limited to first 1 cases.                                                                             

 

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD



--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Question about formatting Summarize output

Jeff6610

Thanks Jon and Michael,

 

The print command seems to be best right.

 

Any idea how I can get it to print the value labels instead of actual values?

 

I’m having trouble finding the correct option for this on-line.

 

Best,

 

Jeff

 

 

From: Jon Peck <[hidden email]>
Sent: Thursday, 17 May 2018 11:55 AM
To: Jeff <[hidden email]>
Cc: SPSS List <[hidden email]>
Subject: Re: [SPSSX-L] Question about formatting Summarize output

 

I think the PRINT command might be what you want.  For example,

print /"ID:" id

/"salary:" salary

/"education:" educ/.

exec.

 

would produce output like this.

ID:   1

salary: $57,000

education:15

 

ID:   2

salary: $40,200

education:16

 

ID:   3

salary: $21,450

education:12

 

You can control the format, and the output can be written directly to a file.  PRINT EJECT would cause each case to be written to a new page.

 

See the CSR for full details.

 

On Wed, May 16, 2018 at 3:01 PM, Jeff <[hidden email]> wrote:

 

Hello everyone,

 

I have survey data and need to print/output a number of the survey participant’s selected survey answers one case at a time so that interviewers conducting follow-up interviews will have a list of several (but not all) of the participants’ answers.

 

The syntax below comes close, but I get a table (similar to below) with the answers horizontally and when I add more variables I’ll run out of room on the page.

 

Instead, I need to format the output so that my list of selected variable names and answers runs vertically with one variable and the corresponding answer/value for one participant is on each row of output.

 

I’ll eventually want to write some type of macro or loop or similar to handle more than a single case number at a time.

 

How might I accomplish this?

 

Thanks in advance,

 

Jeff

 

 

Temporary.

Select If ($CaseNum = 1).

SUMMARIZE

  /TABLES=Sex Age Race Nativity

  /FORMAT=VALIDLIST  NOTOTAL LIMIT=1

  /TITLE='Sex Age Race'

  /MISSING=VARIABLE

/Cells = None .

 

                                                               

Case Number     Sex         Age                  Race                                                       Nativity

6                         Female     20           Caucasian/White              Foreign born / Born overseas

a Limited to first 1 cases.                                                                             

 

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD



 

--

Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Question about formatting Summarize output

PRogman
You could use a temporary variable:

STRING #s (A25).
COMPUTE #s = VALUELABEL(educ).

PRINT
  /"ID:" id
  /"Salary:" salary
  /"Education:" #s
.
EXECUTE.


/PRogman


Jeff-2 wrote

> Thanks Jon and Michael,
> The print command seems to be best right.
>
> Any idea how I can get it to print the value labels instead of actual
> values?
> I’m having trouble finding the correct option for this on-line.
>
> Best,
> Jeff
>
> From: Jon Peck &lt;

> jkpeck@

> &gt;
> Sent: Thursday, 17 May 2018 11:55 AM
> To: Jeff &lt;

> misc5@.pair

> &gt;
> Cc: SPSS List &lt;

> SPSSX-L@.uga

> &gt;
> Subject: Re: [SPSSX-L] Question about formatting Summarize output
>
> I think the PRINT command might be what you want.  For example,
>
> print /"ID:" id
> /"salary:" salary
> /"education:" educ/.
> exec.
>
> would produce output like this.
>
> ID:   1
> salary: $57,000
> education:15
>
> ID:   2
> salary: $40,200
> education:16
>
> ID:   3
> salary: $21,450
> education:12
>
> You can control the format, and the output can be written directly to a
> file.  PRINT EJECT would cause each case to be written to a new page.
> See the CSR for full details.
>
> On Wed, May 16, 2018 at 3:01 PM, Jeff &lt;

> misc5@.pair

>  &lt;mailto:

> misc5@.pair

> &gt; > wrote:
>
> Hello everyone,
> I have survey data and need to print/output a number of the survey
> participant’s selected survey answers one case at a time so that
> interviewers conducting follow-up interviews will have a list of several
> (but not all) of the participants’ answers.
> The syntax below comes close, but I get a table (similar to below) with
> the answers horizontally and when I add more variables I’ll run out of
> room on the page.
> Instead, I need to format the output so that my list of selected variable
> names and answers runs vertically with one variable and the corresponding
> answer/value for one participant is on each row of output.
> I’ll eventually want to write some type of macro or loop or similar to
> handle more than a single case number at a time.
> How might I accomplish this?
>
> Thanks in advance,
> Jeff
>
> Temporary.
> Select If ($CaseNum = 1).
> SUMMARIZE
>   /TABLES=Sex Age Race Nativity
>   /FORMAT=VALIDLIST  NOTOTAL LIMIT=1
>   /TITLE='Sex Age Race'
>   /MISSING=VARIABLE
>   /Cells = None .
>
> Case Number     Sex         Age                  Race                                                      
> Nativity
> 6                         Female     20           Caucasian/White            
> Foreign born / Born overseas
>
> a Limited to first 1 cases.                                                                              
>
> ===================== To manage your subscription to SPSSX-L, send a
> message to

> LISTSERV@.UGA

>  &lt;mailto:

> LISTSERV@.UGA

> &gt;  (not to SPSSX-L), with no body text except the command. To leave the
> list, send the command SIGNOFF SPSSX-L For a list of commands to manage
> subscriptions, send the command INFO REFCARD
>
> --
>
> Jon K Peck

> jkpeck@

>  &lt;mailto:

> jkpeck@

> &gt;
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD





--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Question about formatting Summarize output

Jon Peck
In reply to this post by Jeff6610
The PRINT and WRITE commands do not provide the option of substituting value labels for values, but you can create a new set of variables that have the value labels by using the VALUELABELS transformation function.  For example,
string labeled_x (a30).
compute labeled_x = valuelabel(x).
etc with whatever string width you need.  Then use those variables in your print or write command.  The macro recently posted by David might come in handy here.

On Wed, May 16, 2018 at 10:14 PM, Jeff <[hidden email]> wrote:

Thanks Jon and Michael,

 

The print command seems to be best right.

 

Any idea how I can get it to print the value labels instead of actual values?

 

I’m having trouble finding the correct option for this on-line.

 

Best,

 

Jeff

 

 

From: Jon Peck <[hidden email]>
Sent: Thursday, 17 May 2018 11:55 AM
To: Jeff <[hidden email]>
Cc: SPSS List <[hidden email]>
Subject: Re: [SPSSX-L] Question about formatting Summarize output

 

I think the PRINT command might be what you want.  For example,

print /"ID:" id

/"salary:" salary

/"education:" educ/.

exec.

 

would produce output like this.

ID:   1

salary: $57,000

education:15

 

ID:   2

salary: $40,200

education:16

 

ID:   3

salary: $21,450

education:12

 

You can control the format, and the output can be written directly to a file.  PRINT EJECT would cause each case to be written to a new page.

 

See the CSR for full details.

 

On Wed, May 16, 2018 at 3:01 PM, Jeff <[hidden email]> wrote:

 

Hello everyone,

 

I have survey data and need to print/output a number of the survey participant’s selected survey answers one case at a time so that interviewers conducting follow-up interviews will have a list of several (but not all) of the participants’ answers.

 

The syntax below comes close, but I get a table (similar to below) with the answers horizontally and when I add more variables I’ll run out of room on the page.

 

Instead, I need to format the output so that my list of selected variable names and answers runs vertically with one variable and the corresponding answer/value for one participant is on each row of output.

 

I’ll eventually want to write some type of macro or loop or similar to handle more than a single case number at a time.

 

How might I accomplish this?

 

Thanks in advance,

 

Jeff

 

 

Temporary.

Select If ($CaseNum = 1).

SUMMARIZE

  /TABLES=Sex Age Race Nativity

  /FORMAT=VALIDLIST  NOTOTAL LIMIT=1

  /TITLE='Sex Age Race'

  /MISSING=VARIABLE

/Cells = None .

 

                                                               

Case Number     Sex         Age                  Race                                                       Nativity

6                         Female     20           Caucasian/White              Foreign born / Born overseas

a Limited to first 1 cases.                                                                             

 

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD



 

--

Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD



--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD