Re: Capitalize the First Word in the Quotation Mark using SPSS

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

Re: Capitalize the First Word in the Quotation Mark using SPSS

Hans Chen
Dear lister(s):

My value labels look like as follows:

/Q2M1 TO Q2M3

01           "Happy With Convenient Garbage and Recycle"

02           "Always Room For Some Improvement/ Needs"

03           "Services Aren't Regular/ Not Often Enough"

04           "Garbage Sits Too Long And Ends Up All Over"

05           "A Costly Service For What Is Done"

06           "In The Winter They Should Pick Up More O"

07           "The Price Is Pretty Good For The Convenience"

08           "Need More And Better Recycling Services"

09           "Bins Overflowing"

10           "Too Many Restrictions On What And How Mu"

11           "Private Pick Up/ Excellent Service"

12           "I Live In A Good Neighborhood With Good "

13           "Furniture/ Large Pieces Sit Out Here For"

14           "High Density Are/ Need More Service/ Lit"

15           "I Am Not Sure What We Pay For It Now"

16           "I Have Seen What People In Other Parts O"

17           "I Dislike When People Misuse The System/"

18           "The Recycling Is Convenient, Good Back A"

96           "Just Satisfied/ Fair Adequate"

98           "Don't Know (DO NOT READ)"

99           "Refused (DO NOT READ)"



I would like to change them as follows: the first word in the quotation mark
in each row is capitalized. I have tried to transform the font in Microsoft
Word and Excel but failed. To change it manually would be very boring and
time-consuming. Could you tell me whether it is possible to do it using SPSS
syntax? You response will be highly appreciated.







Hans Chen

=======================================================

/Q2M1 TO Q2M3

01           "Happy with convenient garbage and recycle"

02           "Always room for some improvement/ needs"

03           "Services aren't regular/ not often enough"

04           "Garbage sits too long and ends up all over"

05           "A costly service for what is done"

06           "In the winter they should pick up more"

07           "The price is pretty good for the convenience"

08           "Need more and better recycling services"

09           "Bins overflowing"

10           "Too many restrictions on what and how mu"

11           "Private pick up/ excellent service"

12           "I live in a good neighborhood with good"

13           "Furniture/ large pieces sit out here for"

14           "High density is/ need more service/ lit"

15           "I am not sure what we pay for it now"

16           "I have seen what people in other parts o"

17           "I dislike when people misuse the system/"

18           "The recycling is convenient, good back a"

96           "Just satisfied/ fair adequate"

98           "Don't know (DO NOT READ)"

99           "Refused (DO NOT READ)"

=====================
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: Capitalize the First Word in the Quotation Mark using SPSS

Hector Maletta
Hans,
SPSS syntax cannot do this.
Since you have tried Word, I think you may use it. I think the solution is:
Format - Change case - Sentence case.
However, each label should start at the beginning of the sentence, otherwise
this would not work. Since you need also the quotation marks and the value,
you may first copy everything in Excel, one column for the value, one for
each quotation mark, and one for the text. Then copy the text in Word, apply
Change Case in Word, copy back to Excel, finally copy from Excel to the
syntax file.
I have not tried it, and I reckon it is rather cumbersome, but it should
work.
Hector



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Hans Chen
Sent: 06 April 2008 10:09
To: [hidden email]
Subject: Re: Capitalize the First Word in the Quotation Mark using SPSS

Dear lister(s):

My value labels look like as follows:

/Q2M1 TO Q2M3

01           "Happy With Convenient Garbage and Recycle"

02           "Always Room For Some Improvement/ Needs"

03           "Services Aren't Regular/ Not Often Enough"

04           "Garbage Sits Too Long And Ends Up All Over"

05           "A Costly Service For What Is Done"

06           "In The Winter They Should Pick Up More O"

07           "The Price Is Pretty Good For The Convenience"

08           "Need More And Better Recycling Services"

09           "Bins Overflowing"

10           "Too Many Restrictions On What And How Mu"

11           "Private Pick Up/ Excellent Service"

12           "I Live In A Good Neighborhood With Good "

13           "Furniture/ Large Pieces Sit Out Here For"

14           "High Density Are/ Need More Service/ Lit"

15           "I Am Not Sure What We Pay For It Now"

16           "I Have Seen What People In Other Parts O"

17           "I Dislike When People Misuse The System/"

18           "The Recycling Is Convenient, Good Back A"

96           "Just Satisfied/ Fair Adequate"

98           "Don't Know (DO NOT READ)"

99           "Refused (DO NOT READ)"



I would like to change them as follows: the first word in the quotation mark
in each row is capitalized. I have tried to transform the font in Microsoft
Word and Excel but failed. To change it manually would be very boring and
time-consuming. Could you tell me whether it is possible to do it using SPSS
syntax? You response will be highly appreciated.







Hans Chen

=======================================================

/Q2M1 TO Q2M3

01           "Happy with convenient garbage and recycle"

02           "Always room for some improvement/ needs"

03           "Services aren't regular/ not often enough"

04           "Garbage sits too long and ends up all over"

05           "A costly service for what is done"

06           "In the winter they should pick up more"

07           "The price is pretty good for the convenience"

08           "Need more and better recycling services"

09           "Bins overflowing"

10           "Too many restrictions on what and how mu"

11           "Private pick up/ excellent service"

12           "I live in a good neighborhood with good"

13           "Furniture/ large pieces sit out here for"

14           "High density is/ need more service/ lit"

15           "I am not sure what we pay for it now"

16           "I have seen what people in other parts o"

17           "I dislike when people misuse the system/"

18           "The recycling is convenient, good back a"

96           "Just satisfied/ fair adequate"

98           "Don't know (DO NOT READ)"

99           "Refused (DO NOT READ)"

=====================
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: Capitalize the First Word in the Quotation Mark using SPSS

Peck, Jon
Actually, if you want to construct new value label syntax with the corrected text, you can do it using the valuelabel function and appropriate index functions.  This would be much easier to do with programmability, though.

HTH,
Jon Peck

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Hector Maletta
Sent: Sunday, April 06, 2008 8:42 AM
To: [hidden email]
Subject: Re: [SPSSX-L] Capitalize the First Word in the Quotation Mark using SPSS

Hans,
SPSS syntax cannot do this.
Since you have tried Word, I think you may use it. I think the solution is:
Format - Change case - Sentence case.
However, each label should start at the beginning of the sentence, otherwise
this would not work. Since you need also the quotation marks and the value,
you may first copy everything in Excel, one column for the value, one for
each quotation mark, and one for the text. Then copy the text in Word, apply
Change Case in Word, copy back to Excel, finally copy from Excel to the
syntax file.
I have not tried it, and I reckon it is rather cumbersome, but it should
work.
Hector



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Hans Chen
Sent: 06 April 2008 10:09
To: [hidden email]
Subject: Re: Capitalize the First Word in the Quotation Mark using SPSS

Dear lister(s):

My value labels look like as follows:

/Q2M1 TO Q2M3

01           "Happy With Convenient Garbage and Recycle"

02           "Always Room For Some Improvement/ Needs"

03           "Services Aren't Regular/ Not Often Enough"

04           "Garbage Sits Too Long And Ends Up All Over"

05           "A Costly Service For What Is Done"

06           "In The Winter They Should Pick Up More O"

07           "The Price Is Pretty Good For The Convenience"

08           "Need More And Better Recycling Services"

09           "Bins Overflowing"

10           "Too Many Restrictions On What And How Mu"

11           "Private Pick Up/ Excellent Service"

12           "I Live In A Good Neighborhood With Good "

13           "Furniture/ Large Pieces Sit Out Here For"

14           "High Density Are/ Need More Service/ Lit"

15           "I Am Not Sure What We Pay For It Now"

16           "I Have Seen What People In Other Parts O"

17           "I Dislike When People Misuse The System/"

18           "The Recycling Is Convenient, Good Back A"

96           "Just Satisfied/ Fair Adequate"

98           "Don't Know (DO NOT READ)"

99           "Refused (DO NOT READ)"



I would like to change them as follows: the first word in the quotation mark
in each row is capitalized. I have tried to transform the font in Microsoft
Word and Excel but failed. To change it manually would be very boring and
time-consuming. Could you tell me whether it is possible to do it using SPSS
syntax? You response will be highly appreciated.







Hans Chen

=======================================================

/Q2M1 TO Q2M3

01           "Happy with convenient garbage and recycle"

02           "Always room for some improvement/ needs"

03           "Services aren't regular/ not often enough"

04           "Garbage sits too long and ends up all over"

05           "A costly service for what is done"

06           "In the winter they should pick up more"

07           "The price is pretty good for the convenience"

08           "Need more and better recycling services"

09           "Bins overflowing"

10           "Too many restrictions on what and how mu"

11           "Private pick up/ excellent service"

12           "I live in a good neighborhood with good"

13           "Furniture/ large pieces sit out here for"

14           "High density is/ need more service/ lit"

15           "I am not sure what we pay for it now"

16           "I have seen what people in other parts o"

17           "I dislike when people misuse the system/"

18           "The recycling is convenient, good back a"

96           "Just satisfied/ fair adequate"

98           "Don't know (DO NOT READ)"

99           "Refused (DO NOT READ)"

=====================
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

=====================
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: Capitalize the First Word in the Quotation Mark using SPSS

Oliver, Richard
In reply to this post by Hector Maletta
Technically, this is possible with SPSS syntax, although as Jon Peck points out, programmability with Python is probably a better way to go. But here's one syntax solution (it's not very pretty):

*create some sample data.
data list free /var1 to var3.
begin data
1 2 3
2 1 3
3 3 2
end data.
value labels var1
 1 "Abc Def Ghi"
 2 "Bcd Efg Hij"
 3 "Cde Fgh Ijk".
*real job starts here.
string labelvar(a11)#first (a1) #rest (a10).
compute labelvar=lower(valuelabel(var1)).
compute #first=upper(substr(labelvar,1,1)).
compute #rest=substr(labelvar,2).
compute labelvar=concat(#first, #rest).
do if $casenum=1.
write outfile='c:\temp\temp.sps'
 /"value labels var1 to var3".
end if.
write outfile='c:\temp\temp.sps'
 /var1 ' "' labelvar '"'.
execute.
insert file='c:\temp\temp.sps'
 syntax=batch.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Hector Maletta
Sent: Sunday, April 06, 2008 9:42 AM
To: [hidden email]
Subject: Re: Capitalize the First Word in the Quotation Mark using SPSS

Hans,
SPSS syntax cannot do this.
Since you have tried Word, I think you may use it. I think the solution is:
Format - Change case - Sentence case.
However, each label should start at the beginning of the sentence, otherwise
this would not work. Since you need also the quotation marks and the value,
you may first copy everything in Excel, one column for the value, one for
each quotation mark, and one for the text. Then copy the text in Word, apply
Change Case in Word, copy back to Excel, finally copy from Excel to the
syntax file.
I have not tried it, and I reckon it is rather cumbersome, but it should
work.
Hector



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Hans Chen
Sent: 06 April 2008 10:09
To: [hidden email]
Subject: Re: Capitalize the First Word in the Quotation Mark using SPSS

Dear lister(s):

My value labels look like as follows:

/Q2M1 TO Q2M3

01           "Happy With Convenient Garbage and Recycle"

02           "Always Room For Some Improvement/ Needs"

03           "Services Aren't Regular/ Not Often Enough"

04           "Garbage Sits Too Long And Ends Up All Over"

05           "A Costly Service For What Is Done"

06           "In The Winter They Should Pick Up More O"

07           "The Price Is Pretty Good For The Convenience"

08           "Need More And Better Recycling Services"

09           "Bins Overflowing"

10           "Too Many Restrictions On What And How Mu"

11           "Private Pick Up/ Excellent Service"

12           "I Live In A Good Neighborhood With Good "

13           "Furniture/ Large Pieces Sit Out Here For"

14           "High Density Are/ Need More Service/ Lit"

15           "I Am Not Sure What We Pay For It Now"

16           "I Have Seen What People In Other Parts O"

17           "I Dislike When People Misuse The System/"

18           "The Recycling Is Convenient, Good Back A"

96           "Just Satisfied/ Fair Adequate"

98           "Don't Know (DO NOT READ)"

99           "Refused (DO NOT READ)"



I would like to change them as follows: the first word in the quotation mark
in each row is capitalized. I have tried to transform the font in Microsoft
Word and Excel but failed. To change it manually would be very boring and
time-consuming. Could you tell me whether it is possible to do it using SPSS
syntax? You response will be highly appreciated.







Hans Chen

=======================================================

/Q2M1 TO Q2M3

01           "Happy with convenient garbage and recycle"

02           "Always room for some improvement/ needs"

03           "Services aren't regular/ not often enough"

04           "Garbage sits too long and ends up all over"

05           "A costly service for what is done"

06           "In the winter they should pick up more"

07           "The price is pretty good for the convenience"

08           "Need more and better recycling services"

09           "Bins overflowing"

10           "Too many restrictions on what and how mu"

11           "Private pick up/ excellent service"

12           "I live in a good neighborhood with good"

13           "Furniture/ large pieces sit out here for"

14           "High density is/ need more service/ lit"

15           "I am not sure what we pay for it now"

16           "I have seen what people in other parts o"

17           "I dislike when people misuse the system/"

18           "The recycling is convenient, good back a"

96           "Just satisfied/ fair adequate"

98           "Don't know (DO NOT READ)"

99           "Refused (DO NOT READ)"

=====================
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

=====================
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: Capitalize the First Word in the Quotation Mark using SPSS

Hector Maletta
Excellent, Oliver. So it is possible with syntax.
Thanks for this useful bit.
Hector

-----Original Message-----
From: Oliver, Richard [mailto:[hidden email]]
Sent: 06 April 2008 14:15
To: Hector Maletta; [hidden email]
Subject: RE: Re: Capitalize the First Word in the Quotation Mark using SPSS

Technically, this is possible with SPSS syntax, although as Jon Peck points
out, programmability with Python is probably a better way to go. But here's
one syntax solution (it's not very pretty):

*create some sample data.
data list free /var1 to var3.
begin data
1 2 3
2 1 3
3 3 2
end data.
value labels var1
 1 "Abc Def Ghi"
 2 "Bcd Efg Hij"
 3 "Cde Fgh Ijk".
*real job starts here.
string labelvar(a11)#first (a1) #rest (a10).
compute labelvar=lower(valuelabel(var1)).
compute #first=upper(substr(labelvar,1,1)).
compute #rest=substr(labelvar,2).
compute labelvar=concat(#first, #rest).
do if $casenum=1.
write outfile='c:\temp\temp.sps'
 /"value labels var1 to var3".
end if.
write outfile='c:\temp\temp.sps'
 /var1 ' "' labelvar '"'.
execute.
insert file='c:\temp\temp.sps'
 syntax=batch.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Hector Maletta
Sent: Sunday, April 06, 2008 9:42 AM
To: [hidden email]
Subject: Re: Capitalize the First Word in the Quotation Mark using SPSS

Hans,
SPSS syntax cannot do this.
Since you have tried Word, I think you may use it. I think the solution is:
Format - Change case - Sentence case.
However, each label should start at the beginning of the sentence, otherwise
this would not work. Since you need also the quotation marks and the value,
you may first copy everything in Excel, one column for the value, one for
each quotation mark, and one for the text. Then copy the text in Word, apply
Change Case in Word, copy back to Excel, finally copy from Excel to the
syntax file.
I have not tried it, and I reckon it is rather cumbersome, but it should
work.
Hector



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Hans Chen
Sent: 06 April 2008 10:09
To: [hidden email]
Subject: Re: Capitalize the First Word in the Quotation Mark using SPSS

Dear lister(s):

My value labels look like as follows:

/Q2M1 TO Q2M3

01           "Happy With Convenient Garbage and Recycle"

02           "Always Room For Some Improvement/ Needs"

03           "Services Aren't Regular/ Not Often Enough"

04           "Garbage Sits Too Long And Ends Up All Over"

05           "A Costly Service For What Is Done"

06           "In The Winter They Should Pick Up More O"

07           "The Price Is Pretty Good For The Convenience"

08           "Need More And Better Recycling Services"

09           "Bins Overflowing"

10           "Too Many Restrictions On What And How Mu"

11           "Private Pick Up/ Excellent Service"

12           "I Live In A Good Neighborhood With Good "

13           "Furniture/ Large Pieces Sit Out Here For"

14           "High Density Are/ Need More Service/ Lit"

15           "I Am Not Sure What We Pay For It Now"

16           "I Have Seen What People In Other Parts O"

17           "I Dislike When People Misuse The System/"

18           "The Recycling Is Convenient, Good Back A"

96           "Just Satisfied/ Fair Adequate"

98           "Don't Know (DO NOT READ)"

99           "Refused (DO NOT READ)"



I would like to change them as follows: the first word in the quotation mark
in each row is capitalized. I have tried to transform the font in Microsoft
Word and Excel but failed. To change it manually would be very boring and
time-consuming. Could you tell me whether it is possible to do it using SPSS
syntax? You response will be highly appreciated.







Hans Chen

=======================================================

/Q2M1 TO Q2M3

01           "Happy with convenient garbage and recycle"

02           "Always room for some improvement/ needs"

03           "Services aren't regular/ not often enough"

04           "Garbage sits too long and ends up all over"

05           "A costly service for what is done"

06           "In the winter they should pick up more"

07           "The price is pretty good for the convenience"

08           "Need more and better recycling services"

09           "Bins overflowing"

10           "Too many restrictions on what and how mu"

11           "Private pick up/ excellent service"

12           "I live in a good neighborhood with good"

13           "Furniture/ large pieces sit out here for"

14           "High density is/ need more service/ lit"

15           "I am not sure what we pay for it now"

16           "I have seen what people in other parts o"

17           "I dislike when people misuse the system/"

18           "The recycling is convenient, good back a"

96           "Just satisfied/ fair adequate"

98           "Don't know (DO NOT READ)"

99           "Refused (DO NOT READ)"

=====================
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

=====================
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: Capitalize the First Word in the Quotation Mark using SPSS

Oliver, Richard
Oops. I think my example data led me to an incomplete solution. You need to aggregate by labelvar. I'll post a more complete solution in a few minutes.

________________________________

From: SPSSX(r) Discussion on behalf of Hector Maletta
Sent: Sun 4/6/2008 12:40 PM
To: [hidden email]
Subject: Re: Capitalize the First Word in the Quotation Mark using SPSS



Excellent, Oliver. So it is possible with syntax.
Thanks for this useful bit.
Hector

-----Original Message-----
From: Oliver, Richard [mailto:[hidden email]]
Sent: 06 April 2008 14:15
To: Hector Maletta; [hidden email]
Subject: RE: Re: Capitalize the First Word in the Quotation Mark using SPSS

Technically, this is possible with SPSS syntax, although as Jon Peck points
out, programmability with Python is probably a better way to go. But here's
one syntax solution (it's not very pretty):

*create some sample data.
data list free /var1 to var3.
begin data
1 2 3
2 1 3
3 3 2
end data.
value labels var1
 1 "Abc Def Ghi"
 2 "Bcd Efg Hij"
 3 "Cde Fgh Ijk".
*real job starts here.
string labelvar(a11)#first (a1) #rest (a10).
compute labelvar=lower(valuelabel(var1)).
compute #first=upper(substr(labelvar,1,1)).
compute #rest=substr(labelvar,2).
compute labelvar=concat(#first, #rest).
do if $casenum=1.
write outfile='c:\temp\temp.sps'
 /"value labels var1 to var3".
end if.
write outfile='c:\temp\temp.sps'
 /var1 ' "' labelvar '"'.
execute.
insert file='c:\temp\temp.sps'
 syntax=batch.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Hector Maletta
Sent: Sunday, April 06, 2008 9:42 AM
To: [hidden email]
Subject: Re: Capitalize the First Word in the Quotation Mark using SPSS

Hans,
SPSS syntax cannot do this.
Since you have tried Word, I think you may use it. I think the solution is:
Format - Change case - Sentence case.
However, each label should start at the beginning of the sentence, otherwise
this would not work. Since you need also the quotation marks and the value,
you may first copy everything in Excel, one column for the value, one for
each quotation mark, and one for the text. Then copy the text in Word, apply
Change Case in Word, copy back to Excel, finally copy from Excel to the
syntax file.
I have not tried it, and I reckon it is rather cumbersome, but it should
work.
Hector



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Hans Chen
Sent: 06 April 2008 10:09
To: [hidden email]
Subject: Re: Capitalize the First Word in the Quotation Mark using SPSS

Dear lister(s):

My value labels look like as follows:

/Q2M1 TO Q2M3

01           "Happy With Convenient Garbage and Recycle"

02           "Always Room For Some Improvement/ Needs"

03           "Services Aren't Regular/ Not Often Enough"

04           "Garbage Sits Too Long And Ends Up All Over"

05           "A Costly Service For What Is Done"

06           "In The Winter They Should Pick Up More O"

07           "The Price Is Pretty Good For The Convenience"

08           "Need More And Better Recycling Services"

09           "Bins Overflowing"

10           "Too Many Restrictions On What And How Mu"

11           "Private Pick Up/ Excellent Service"

12           "I Live In A Good Neighborhood With Good "

13           "Furniture/ Large Pieces Sit Out Here For"

14           "High Density Are/ Need More Service/ Lit"

15           "I Am Not Sure What We Pay For It Now"

16           "I Have Seen What People In Other Parts O"

17           "I Dislike When People Misuse The System/"

18           "The Recycling Is Convenient, Good Back A"

96           "Just Satisfied/ Fair Adequate"

98           "Don't Know (DO NOT READ)"

99           "Refused (DO NOT READ)"



I would like to change them as follows: the first word in the quotation mark
in each row is capitalized. I have tried to transform the font in Microsoft
Word and Excel but failed. To change it manually would be very boring and
time-consuming. Could you tell me whether it is possible to do it using SPSS
syntax? You response will be highly appreciated.







Hans Chen

=======================================================

/Q2M1 TO Q2M3

01           "Happy with convenient garbage and recycle"

02           "Always room for some improvement/ needs"

03           "Services aren't regular/ not often enough"

04           "Garbage sits too long and ends up all over"

05           "A costly service for what is done"

06           "In the winter they should pick up more"

07           "The price is pretty good for the convenience"

08           "Need more and better recycling services"

09           "Bins overflowing"

10           "Too many restrictions on what and how mu"

11           "Private pick up/ excellent service"

12           "I live in a good neighborhood with good"

13           "Furniture/ large pieces sit out here for"

14           "High density is/ need more service/ lit"

15           "I am not sure what we pay for it now"

16           "I have seen what people in other parts o"

17           "I dislike when people misuse the system/"

18           "The recycling is convenient, good back a"

96           "Just satisfied/ fair adequate"

98           "Don't know (DO NOT READ)"

99           "Refused (DO NOT READ)"

=====================
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

=====================
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: Capitalize the First Word in the Quotation Mark using SPSS

Oliver, Richard
The more complete (and slightly more complicated) solution:
 
*create some sample data.
data list list /var1 to var3.
begin data
3 2 1
1 2 3
2 1 3
3 3 2
1 1 1
1 2 1
1 3 3
end data.
value labels var1
 1 "Abc Def"
 2 "Bcd Efg Hij"
 3 "Cde Fg Hi".
*real job starts here.
dataset name original.
string labelvar(a11)#first (a1) #rest (a10).
compute labelvar=lower(valuelabel(var1)).
compute #first=upper(substr(labelvar,1,1)).
compute #rest=substr(labelvar,2).
compute labelvar=concat(#first, #rest).
dataset declare aggfile.
aggregate outfile=aggfile /break=labelvar /var1=first(var1).
dataset activate aggfile.
do if $casenum=1.
write outfile='c:\temp\temp.sps'
 /"value labels var1 to var3".
end if.
write outfile='c:\temp\temp.sps'
 /var1 ' "' labelvar '"'.
execute.
dataset activate original.
insert file='c:\temp\temp.sps'
 syntax=batch.


________________________________

From: Oliver, Richard
Sent: Sun 4/6/2008 3:21 PM
To: Hector Maletta; [hidden email]
Subject: RE: Re: Capitalize the First Word in the Quotation Mark using SPSS


Oops. I think my example data led me to an incomplete solution. You need to aggregate by labelvar. I'll post a more complete solution in a few minutes.

________________________________

From: SPSSX(r) Discussion on behalf of Hector Maletta
Sent: Sun 4/6/2008 12:40 PM
To: [hidden email]
Subject: Re: Capitalize the First Word in the Quotation Mark using SPSS



Excellent, Oliver. So it is possible with syntax.
Thanks for this useful bit.
Hector

-----Original Message-----
From: Oliver, Richard [mailto:[hidden email]]
Sent: 06 April 2008 14:15
To: Hector Maletta; [hidden email]
Subject: RE: Re: Capitalize the First Word in the Quotation Mark using SPSS

Technically, this is possible with SPSS syntax, although as Jon Peck points
out, programmability with Python is probably a better way to go. But here's
one syntax solution (it's not very pretty):

*create some sample data.
data list free /var1 to var3.
begin data
1 2 3
2 1 3
3 3 2
end data.
value labels var1
 1 "Abc Def Ghi"
 2 "Bcd Efg Hij"
 3 "Cde Fgh Ijk".
*real job starts here.
string labelvar(a11)#first (a1) #rest (a10).
compute labelvar=lower(valuelabel(var1)).
compute #first=upper(substr(labelvar,1,1)).
compute #rest=substr(labelvar,2).
compute labelvar=concat(#first, #rest).
do if $casenum=1.
write outfile='c:\temp\temp.sps'
 /"value labels var1 to var3".
end if.
write outfile='c:\temp\temp.sps'
 /var1 ' "' labelvar '"'.
execute.
insert file='c:\temp\temp.sps'
 syntax=batch.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Hector Maletta
Sent: Sunday, April 06, 2008 9:42 AM
To: [hidden email]
Subject: Re: Capitalize the First Word in the Quotation Mark using SPSS

Hans,
SPSS syntax cannot do this.
Since you have tried Word, I think you may use it. I think the solution is:
Format - Change case - Sentence case.
However, each label should start at the beginning of the sentence, otherwise
this would not work. Since you need also the quotation marks and the value,
you may first copy everything in Excel, one column for the value, one for
each quotation mark, and one for the text. Then copy the text in Word, apply
Change Case in Word, copy back to Excel, finally copy from Excel to the
syntax file.
I have not tried it, and I reckon it is rather cumbersome, but it should
work.
Hector



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Hans Chen
Sent: 06 April 2008 10:09
To: [hidden email]
Subject: Re: Capitalize the First Word in the Quotation Mark using SPSS

Dear lister(s):

My value labels look like as follows:

/Q2M1 TO Q2M3

01           "Happy With Convenient Garbage and Recycle"

02           "Always Room For Some Improvement/ Needs"

03           "Services Aren't Regular/ Not Often Enough"

04           "Garbage Sits Too Long And Ends Up All Over"

05           "A Costly Service For What Is Done"

06           "In The Winter They Should Pick Up More O"

07           "The Price Is Pretty Good For The Convenience"

08           "Need More And Better Recycling Services"

09           "Bins Overflowing"

10           "Too Many Restrictions On What And How Mu"

11           "Private Pick Up/ Excellent Service"

12           "I Live In A Good Neighborhood With Good "

13           "Furniture/ Large Pieces Sit Out Here For"

14           "High Density Are/ Need More Service/ Lit"

15           "I Am Not Sure What We Pay For It Now"

16           "I Have Seen What People In Other Parts O"

17           "I Dislike When People Misuse The System/"

18           "The Recycling Is Convenient, Good Back A"

96           "Just Satisfied/ Fair Adequate"

98           "Don't Know (DO NOT READ)"

99           "Refused (DO NOT READ)"



I would like to change them as follows: the first word in the quotation mark
in each row is capitalized. I have tried to transform the font in Microsoft
Word and Excel but failed. To change it manually would be very boring and
time-consuming. Could you tell me whether it is possible to do it using SPSS
syntax? You response will be highly appreciated.







Hans Chen

=======================================================

/Q2M1 TO Q2M3

01           "Happy with convenient garbage and recycle"

02           "Always room for some improvement/ needs"

03           "Services aren't regular/ not often enough"

04           "Garbage sits too long and ends up all over"

05           "A costly service for what is done"

06           "In the winter they should pick up more"

07           "The price is pretty good for the convenience"

08           "Need more and better recycling services"

09           "Bins overflowing"

10           "Too many restrictions on what and how mu"

11           "Private pick up/ excellent service"

12           "I live in a good neighborhood with good"

13           "Furniture/ large pieces sit out here for"

14           "High density is/ need more service/ lit"

15           "I am not sure what we pay for it now"

16           "I have seen what people in other parts o"

17           "I dislike when people misuse the system/"

18           "The recycling is convenient, good back a"

96           "Just satisfied/ fair adequate"

98           "Don't know (DO NOT READ)"

99           "Refused (DO NOT READ)"

=====================
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

=====================
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: Capitalize the First Word in the Quotation Mark using SPSS

Peck, Jon
Ok.  Here's a Python way.
First, creating data:
data list list /var1.
begin data
1
end data.
value labels var1
 1 "Abc Def"
 2 "Bcd Efg Hij"
 3 "Cde Fg Hi".
exec.

Now get the value labels, lower case everything, and capitalize the first letter.
begin program.
import spss
spss.StartDataStep()
var=spss.Dataset().varlist['var1']
vl = var.valueLabels.data
for k, v in vl.items():
  vl[k] = vl[k].lower().capitalize()
var.valueLabels = vl
spss.EndDataStep()
end program.

This solution requires SPSS 16, which has added the Dataset class.

In SPSS 15 (or 16), the task could be done like this.
begin program.
import spss, spssaux
vardict = spssaux.VariableDict(namelist='var1')
vl = vardict['var1'].ValueLabels
for k,v in vl:
  vl[k] = vl[k].lower().capitalize()
vardict['var1'].ValueLabels = vl
end program.

Regards,
Jon Peck




-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Oliver, Richard
Sent: Sunday, April 06, 2008 2:37 PM
To: [hidden email]
Subject: Re: [SPSSX-L] Capitalize the First Word in the Quotation Mark using SPSS

The more complete (and slightly more complicated) solution:

*create some sample data.
data list list /var1 to var3.
begin data
3 2 1
1 2 3
2 1 3
3 3 2
1 1 1
1 2 1
1 3 3
end data.
value labels var1
 1 "Abc Def"
 2 "Bcd Efg Hij"
 3 "Cde Fg Hi".
*real job starts here.
dataset name original.
string labelvar(a11)#first (a1) #rest (a10).
compute labelvar=lower(valuelabel(var1)).
compute #first=upper(substr(labelvar,1,1)).
compute #rest=substr(labelvar,2).
compute labelvar=concat(#first, #rest).
dataset declare aggfile.
aggregate outfile=aggfile /break=labelvar /var1=first(var1).
dataset activate aggfile.
do if $casenum=1.
write outfile='c:\temp\temp.sps'
 /"value labels var1 to var3".
end if.
write outfile='c:\temp\temp.sps'
 /var1 ' "' labelvar '"'.
execute.
dataset activate original.
insert file='c:\temp\temp.sps'
 syntax=batch.


________________________________

From: Oliver, Richard
Sent: Sun 4/6/2008 3:21 PM
To: Hector Maletta; [hidden email]
Subject: RE: Re: Capitalize the First Word in the Quotation Mark using SPSS


Oops. I think my example data led me to an incomplete solution. You need to aggregate by labelvar. I'll post a more complete solution in a few minutes.

________________________________

From: SPSSX(r) Discussion on behalf of Hector Maletta
Sent: Sun 4/6/2008 12:40 PM
To: [hidden email]
Subject: Re: Capitalize the First Word in the Quotation Mark using SPSS



Excellent, Oliver. So it is possible with syntax.
Thanks for this useful bit.
Hector

-----Original Message-----
From: Oliver, Richard [mailto:[hidden email]]
Sent: 06 April 2008 14:15
To: Hector Maletta; [hidden email]
Subject: RE: Re: Capitalize the First Word in the Quotation Mark using SPSS

Technically, this is possible with SPSS syntax, although as Jon Peck points
out, programmability with Python is probably a better way to go. But here's
one syntax solution (it's not very pretty):

*create some sample data.
data list free /var1 to var3.
begin data
1 2 3
2 1 3
3 3 2
end data.
value labels var1
 1 "Abc Def Ghi"
 2 "Bcd Efg Hij"
 3 "Cde Fgh Ijk".
*real job starts here.
string labelvar(a11)#first (a1) #rest (a10).
compute labelvar=lower(valuelabel(var1)).
compute #first=upper(substr(labelvar,1,1)).
compute #rest=substr(labelvar,2).
compute labelvar=concat(#first, #rest).
do if $casenum=1.
write outfile='c:\temp\temp.sps'
 /"value labels var1 to var3".
end if.
write outfile='c:\temp\temp.sps'
 /var1 ' "' labelvar '"'.
execute.
insert file='c:\temp\temp.sps'
 syntax=batch.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Hector Maletta
Sent: Sunday, April 06, 2008 9:42 AM
To: [hidden email]
Subject: Re: Capitalize the First Word in the Quotation Mark using SPSS

Hans,
SPSS syntax cannot do this.
Since you have tried Word, I think you may use it. I think the solution is:
Format - Change case - Sentence case.
However, each label should start at the beginning of the sentence, otherwise
this would not work. Since you need also the quotation marks and the value,
you may first copy everything in Excel, one column for the value, one for
each quotation mark, and one for the text. Then copy the text in Word, apply
Change Case in Word, copy back to Excel, finally copy from Excel to the
syntax file.
I have not tried it, and I reckon it is rather cumbersome, but it should
work.
Hector



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Hans Chen
Sent: 06 April 2008 10:09
To: [hidden email]
Subject: Re: Capitalize the First Word in the Quotation Mark using SPSS

Dear lister(s):

My value labels look like as follows:

/Q2M1 TO Q2M3

01           "Happy With Convenient Garbage and Recycle"

02           "Always Room For Some Improvement/ Needs"

03           "Services Aren't Regular/ Not Often Enough"

04           "Garbage Sits Too Long And Ends Up All Over"

05           "A Costly Service For What Is Done"

06           "In The Winter They Should Pick Up More O"

07           "The Price Is Pretty Good For The Convenience"

08           "Need More And Better Recycling Services"

09           "Bins Overflowing"

10           "Too Many Restrictions On What And How Mu"

11           "Private Pick Up/ Excellent Service"

12           "I Live In A Good Neighborhood With Good "

13           "Furniture/ Large Pieces Sit Out Here For"

14           "High Density Are/ Need More Service/ Lit"

15           "I Am Not Sure What We Pay For It Now"

16           "I Have Seen What People In Other Parts O"

17           "I Dislike When People Misuse The System/"

18           "The Recycling Is Convenient, Good Back A"

96           "Just Satisfied/ Fair Adequate"

98           "Don't Know (DO NOT READ)"

99           "Refused (DO NOT READ)"



I would like to change them as follows: the first word in the quotation mark
in each row is capitalized. I have tried to transform the font in Microsoft
Word and Excel but failed. To change it manually would be very boring and
time-consuming. Could you tell me whether it is possible to do it using SPSS
syntax? You response will be highly appreciated.







Hans Chen

=======================================================

/Q2M1 TO Q2M3

01           "Happy with convenient garbage and recycle"

02           "Always room for some improvement/ needs"

03           "Services aren't regular/ not often enough"

04           "Garbage sits too long and ends up all over"

05           "A costly service for what is done"

06           "In the winter they should pick up more"

07           "The price is pretty good for the convenience"

08           "Need more and better recycling services"

09           "Bins overflowing"

10           "Too many restrictions on what and how mu"

11           "Private pick up/ excellent service"

12           "I live in a good neighborhood with good"

13           "Furniture/ large pieces sit out here for"

14           "High density is/ need more service/ lit"

15           "I am not sure what we pay for it now"

16           "I have seen what people in other parts o"

17           "I dislike when people misuse the system/"

18           "The recycling is convenient, good back a"

96           "Just satisfied/ fair adequate"

98           "Don't know (DO NOT READ)"

99           "Refused (DO NOT READ)"

=====================
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

=====================
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

=====================
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
|

saving outfile

Christian Deindl
recently I have problems with the save-command.

sometimes I get following error message:

>Warning # 5334.  Command name: save
>The SAVE command has succeeded.  However, due to contention for the
>specified file, the data have been saved to a file with a different name.

since I could not find an equivalent to statas "replace" option.
what can I do?

christian

=====================
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: saving outfile

Richard Ristow
At 04:42 AM 4/7/2008, Christian Deindl wrote:

>recently I have problems with the save-command. sometimes I get
>following error message:
>
>>Warning # 5334.  Command name: save
>>The SAVE command has succeeded.  However, due to contention for the
>>specified file, the data have been saved to a file with a different name.

I have just failed to reproduce this with SPSS 14. However, things
like this occasionally occur with versions of SPSS that use the
Virtual Active File (VAF). I think that's since 12.5; anyway, it's
any version of SPSS that includes the CACHE command.

Briefly, it's because SPSS has not saved a copy of the working file;
instead, it builds it dynamically from the input, every time you read
it for any purpose. That includes a SAVE: so it can't save under the
old name, because it's still using the old file to build the new file
it's going to save under that name. (Does that make sense? I won't be
surprised, if not.)

Anyway, try a CACHE command immediately before the SAVE that's giving
you trouble.

=====================
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: saving outfile

Mark Palmberg
I reproduced this often under 15 and now under 16.  It certainly is
annoying, particularly when saving SPSS files that then serve as source
files for streams in Clementine.  Given the nature of the things that can go
on in an SPSS file, it seems an odd opportunity to subvert decades of user
experience with the "Save" button.

On Tue, Apr 8, 2008 at 3:06 PM, Richard Ristow <[hidden email]>
wrote:

> At 04:42 AM 4/7/2008, Christian Deindl wrote:
>
>  recently I have problems with the save-command. sometimes I get
> > following error message:
> >
> >  Warning # 5334.  Command name: save
> > > The SAVE command has succeeded.  However, due to contention for the
> > > specified file, the data have been saved to a file with a different
> > > name.
> > >
> >
> I have just failed to reproduce this with SPSS 14. However, things
> like this occasionally occur with versions of SPSS that use the
> Virtual Active File (VAF). I think that's since 12.5; anyway, it's
> any version of SPSS that includes the CACHE command.
>
> Briefly, it's because SPSS has not saved a copy of the working file;
> instead, it builds it dynamically from the input, every time you read
> it for any purpose. That includes a SAVE: so it can't save under the
> old name, because it's still using the old file to build the new file
> it's going to save under that name. (Does that make sense? I won't be
> surprised, if not.)
>
> Anyway, try a CACHE command immediately before the SAVE that's giving
> you trouble.
>
> =====================
> 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