Life History Calendar Data

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

Re: Order don't answer to the final row in custom table

Heidi Green
Hello-
Change this part of your subcommand:
ORDER=D KEY=COUNT

TO:
ORDER = A KEY = VALUE

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Auberth Hurtado
Sent: Friday, August 14, 2009 2:03 PM
To: [hidden email]
Subject: Order don't answer to the final row in custom table

Hi all, I find the answer category (9) at the end of the custom table,
for
example:

DATA LIST FREE/P1.
BEGIN DATA
1 1 1 1 9 9 9 2 2 3
END DATA.

VAL LAB P1
1 'E'
2 'R'
3 'B'
9 'DA' .

CTABLES
  /VLABELS VARIABLES=P1 DISPLAY=DEFAULT
  /TABLE P1 [C][COUNT F40.0]
  /CATEGORIES VARIABLES=P1 ORDER=D KEY=COUNT EMPTY=INCLUDE TOTAL=YES
POSITION=AFTER.


The table looks like:

                Count
P1      E       4
        DA      3
        R       2
        B       1
        Total   10

And I want:

                Count
P1      E       4
        R       2
        B       1
        DA      3
        Total   10

how do I do that?, Thanks for your help.

Auberth.

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

----------------

Defender MX2 - QLAN

=====================
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: Decent GPL reference, please!

Albert-Jan Roskam
In reply to this post by ViAnn Beadle
Hi,

Here's how to dynamically create a .sgt. It's fairly simple; it simply replaces one piece of text in the original template. It could be generalized into a function, so x and y could simply be inputted. And with VariableDict, it should be possible to extract the var labels and put them in the graph.

Cheers!!
Albert-Jan

* Sample dataset *.
DATA LIST FREE/Glucagon HDL.
BEGIN DATA
72 1.03 75 1.06 76 0.92 88 1.04 71 0.91
82 0.81 73 0.90 80 0.95 69 1.12 78 1.08
83 1.13 80 1.16 113 1.22 91 1.24 62 1.09
79 1.01 84 1.10 87 1.15 86 1.12 85 1.08
97 1.15 93 1.34 81 1.19 110 1.20 97 1.11
96 1.13 98 1.35 99 1.19 81 1.18 93 1.21
END DATA.

* Compute r and let OMS grab it....
DATASET DECLARE corrs.
OMS /SELECT TABLES /IF COMMANDS = ["Correlations"] SUBTYPES = ["Correlations"]
 /DESTINATION FORMAT = SAV NUMBERED = TableNumber_ OUTFILE = corrs.
CORRELATIONS
  /VARIABLES=Glucagon HDL
  /PRINT=TWOTAIL NOSIG.
OMSEND.
DATASET ACTIVATE corrs.

* ... and dynamically write it to a template.
BEGIN PROGRAM.
import spss, spssaux
curs = spss.Cursor([spss.GetVariableCount() - 1]) # assumes that r is in the last variable of the OMS data.
r = curs.fetchone()[0]
curs.close()
sgt_in = open("d:/chart_template.sgt", "rb") # MADE BASED ON MARTA'S GRAPH, BUT REPLACE THE R VALUE WITH 'some_text_goes_here'

sgt_out = open("d:/chart_template_dynamic.sgt", "wb")
subst_txt = "some_text_goes_here"
for line in sgt_in:
  if  subst_txt in line:
    sgt_out.write(line.replace(subst_txt,"%2.2f" % r))
  else:
    sgt_out.write(line)
sgt_in.close()
sgt_out.close()

END PROGRAM.

* .. which is subsequently applied.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=HDL Glucagon
  /GRAPHSPEC SOURCE=INLINE TEMPLATE=["D:\chart_template_dynamic.sgt"].
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: HDL=col(source(s), name("HDL"))
 DATA: Glucagon=col(source(s), name("Glucagon"))
 GUIDE: axis(dim(1), label("HDL Colesterol (mmol/l)"))
 GUIDE: axis(dim(2), label("Glucagon (pg/ml)"))
 ELEMENT: point(position(HDL*Glucagon),color.interior(color.black))
END GPL.

--- On Thu, 8/13/09, ViAnn Beadle <[hidden email]> wrote:

> From: ViAnn Beadle <[hidden email]>
> Subject: Re: [SPSSX-L] Decent GPL reference, please!
> To: [hidden email]
> Date: Thursday, August 13, 2009, 2:40 PM
> You can insert a text box using a
> chart template. The issue then is how to
> create the chart template on the fly. I suspect that
> probably could be done
> via Python. Here's a challenge to our Python experts!
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]]
> On Behalf Of
> Marta GarcĂ­a-Granero
> Sent: Thursday, August 13, 2009 1:35 AM
> To: [hidden email]
> Subject: Re: Decent GPL reference, please!
>
> Pirritano, Matthew wrote:
> > Here's a concrete example of the obtuseness of the GPL
> reference manual.
> > I want to simply add the r value to a scatter-plot.
> I've looked up every
> > related term I can think of in the index. I often feel
> that the only way
> > to get anything from this manual, would be to read it
> from cover to
> > cover.
> >
>
> This is the only workaround I have found (add the r value
> as a
> footnote). I think it can be automatic turning it into a
> macro that
> reads the r value, and adds it to the GPL code:
>
> * Sample dataset *.
> DATA LIST FREE/Glucagon HDL.
> BEGIN DATA
> 72 1.03 75 1.06 76 0.92 88 1.04 71 0.91
> 82 0.81 73 0.90 80 0.95 69 1.12 78 1.08
> 83 1.13 80 1.16 113 1.22 91 1.24 62 1.09
> 79 1.01 84 1.10 87 1.15 86 1.12 85 1.08
> 97 1.15 93 1.34 81 1.19 110 1.20 97 1.11
> 96 1.13 98 1.35 99 1.19 81 1.18 93 1.21
> END DATA.
>
> * Compute r and add it manually to the GPL code *.
> CORRELATIONS
>   /VARIABLES=Glucagon HDL
>   /PRINT=TWOTAIL NOSIG.
>
> GGRAPH
>   /GRAPHDATASET NAME="graphdataset" VARIABLES=HDL
> Glucagon
>   /GRAPHSPEC SOURCE=INLINE.
> BEGIN GPL
>  SOURCE: s=userSource(id("graphdataset"))
>  DATA: HDL=col(source(s), name("HDL"))
>  DATA: Glucagon=col(source(s), name("Glucagon"))
>  GUIDE: axis(dim(1), label("HDL Colesterol (mmol/l)"))
>  GUIDE: axis(dim(2), label("Glucagon (pg/ml)"))
>  GUIDE: text.footnote(label("r=0.571"))
>  ELEMENT:
> point(position(HDL*Glucagon),color.interior(color.black))
> END GPL.
>
> Anyway, instead of a footnote, i would have liked to add it
> as a text
> box inside the graph, or as a legend. Is that possible?
>
> Marta GG
>
>
> --
> For miscellaneous SPSS related statistical stuff, visit:
> http://gjyp.nl/marta/
>
> =====================
> 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: Identify Straight-liners

J P-6
In reply to this post by Gyorgy Bea
Hi All,
 
Another term for this behavior is "satisficing" [http://en.wikipedia.org/wiki/Satisficing] or the tendency for a respondent to put as little effort as possible into answering the question.
 
One way of catching this is to insert an item that is conceptully similiar to other items but must be answered differently from the others in order to be in conceptual agreement. A quick and overly simple example (i.e,. the best I can do on a Monday morning : ) :
 
+ Most days I look forward to coming to work (T)
+ Most days I do not look forward to coming to work (F)
 
Problem is it is usually not a good idea to elicit agreement by having someone disgree to a negatively worded question, and too many of these questions will silly and unprofessional.
Best,
John

 


From: Gyorgy Bea <[hidden email]>
To: [hidden email]
Sent: Friday, August 14, 2009 8:02:00 AM
Subject: Re: Identify Straight-liners

Hi Stephen,

So basically all questions and items needs to be analyzed in the first place in order to see if there can be any pattern identified, but only because a respondent answered "in line" (always the first option), doesn't necessarily mean that his responses aren't "quality" responses.
Identifying respondents who is answering in line is quite straight I think, however, identifying the zig-zag, or other patters can be more challenging. Could you suggest how the code for this should work? Is it possible to cover all possible combination when identifying the pattern? 

Best regards,
Beata



From: Statisticsdoc <[hidden email]>
To: [hidden email]
Sent: Thursday, August 13, 2009 11:58:59 PM
Subject: Re: Identify Straight-liners

Beata,
 
I have some code to identify subjects whose responses follow a straight line or a zig-zag pattern.  When examining these cases, it is important to consider the possibility that the pattern could be generated according to meaningful content based responding, or whether the answers are inherently contradictory.  You might want to keep the cases, but note whether the response pattern occurs with an unusually high frequency in certain data collection sites (e.g., in certain classrooms, or in sessions that are administered by a specific research assistant).  Unusually high levels of oddly patterned responding might indicate a need to improve aspects of the data collection process in those sites (I am assuming here that the data may be collected from the same sites on future occassions).
 
Best,
 
Stephen Brand
 
 
-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]]On Behalf Of Gyorgy Bea
Sent: Thursday, August 13, 2009 12:07 PM
To: [hidden email]
Subject: Identify Straight-liners

Do you know any efficient methodology to identify straight-liners in a survey? Any documentation on this theme? I think without a serious analyze of the data, excluding straight-liners could turn easily into data manipulation.
What do you think?

Beata






Reply | Threaded
Open this post in threaded view
|

Re: Identify Straight-liners

Dale

There is a fairly extensive body of research in response sets and other issues in the literature.  A search within the measurement literature on response sets, number of response categories and reverse scored items on scales provide a great deal of information.

 

Dale

 

 

Dale Pietrzak, Ed.D., LPC-MH, CCMHC

Director, Office of Academic Evaluation & Assessment

University of South Dakota

414 East Clark Street

Vermillion, SD  57069

(605) 677-6497

 

“Science is organized knowledge. Wisdom is organized life.”  Immanuel Kant

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of J P
Sent: Monday, August 17, 2009 8:06 AM
To: [hidden email]
Subject: Re: Identify Straight-liners

 

Hi All,

 

Another term for this behavior is "satisficing" [http://en.wikipedia.org/wiki/Satisficing] or the tendency for a respondent to put as little effort as possible into answering the question.

 

One way of catching this is to insert an item that is conceptully similiar to other items but must be answered differently from the others in order to be in conceptual agreement. A quick and overly simple example (i.e,. the best I can do on a Monday morning : ) :

 

+ Most days I look forward to coming to work (T)

+ Most days I do not look forward to coming to work (F)

 

Problem is it is usually not a good idea to elicit agreement by having someone disgree to a negatively worded question, and too many of these questions will silly and unprofessional.

Best,

John


 

 


From: Gyorgy Bea <[hidden email]>
To: [hidden email]
Sent: Friday, August 14, 2009 8:02:00 AM
Subject: Re: Identify Straight-liners

Hi Stephen,

So basically all questions and items needs to be analyzed in the first place in order to see if there can be any pattern identified, but only because a respondent answered "in line" (always the first option), doesn't necessarily mean that his responses aren't "quality" responses.
Identifying respondents who is answering in line is quite straight I think, however, identifying the zig-zag, or other patters can be more challenging. Could you suggest how the code for this should work? Is it possible to cover all possible combination when identifying the pattern? 

Best regards,
Beata

 


From: Statisticsdoc <[hidden email]>
To: [hidden email]
Sent: Thursday, August 13, 2009 11:58:59 PM
Subject: Re: Identify Straight-liners

Beata,

 

I have some code to identify subjects whose responses follow a straight line or a zig-zag pattern.  When examining these cases, it is important to consider the possibility that the pattern could be generated according to meaningful content based responding, or whether the answers are inherently contradictory.  You might want to keep the cases, but note whether the response pattern occurs with an unusually high frequency in certain data collection sites (e.g., in certain classrooms, or in sessions that are administered by a specific research assistant).  Unusually high levels of oddly patterned responding might indicate a need to improve aspects of the data collection process in those sites (I am assuming here that the data may be collected from the same sites on future occassions).

 

Best,

 

Stephen Brand

 

 

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]]On Behalf Of Gyorgy Bea
Sent: Thursday, August 13, 2009 12:07 PM
To: [hidden email]
Subject: Identify Straight-liners

Do you know any efficient methodology to identify straight-liners in a survey? Any documentation on this theme? I think without a serious analyze of the data, excluding straight-liners could turn easily into data manipulation.
What do you think?

Beata

 

 

 

 

 

Reply | Threaded
Open this post in threaded view
|

Re: Life History Calendar Data

Maguin, Eugene
In reply to this post by Laneah
Laneah,

Here is my proposed code. I have tested it and I think it works correctly.
Note that it assumes that the value for the first and last months is 0 or 1.
2s will cause problems. If you wish, I can do more when you resolve how to
count episodes and durations at the beginning and end of the sequence. For
test purposes I used just 60 months. You will need to adjust the code to
reflect your number of months.


data list / m1 to m60 (60f1.0).
begin data
000010000122221000000110000110101222222222222100000101012221
110010000122221000000110000110101222222222222100000101000000
122210000122221000000110000110101222222222222100000101010110
end data.


*  number of episodes.
Format m1 to m60(f1.0).
Recode m1 to m60(sysmis=9).
String months(a60).
Do repeat m=m1 to m60/i=1 to 60.
+  compute substr(months,i,1)=string(m,f1.0).
End repeat.

Compute singles=0.
Loop #i=1 to 58.
+  if (substr(months,#i,3) eq '010') singles=singles+1.
End loop.
*  then this from above.
Count episodes=m1 to m60(1).
Compute episodes=((episodes-singles)/2)+singles.

descriptives episodes/statistics max.
*  the value returned here is used to define the length of the
*  start and duration vectors.

delete variables months.

*  10 episodes found.
vector start(10,f2.0) duration(10,f2.0).
vector months=m1 to m60. /* change 60 to your value throughout.
compute totmonths=60.
compute nepisode=0.
loop #i=1 to 60.
+  do if (months(#i) eq 1).
+     do if (#i eq 1). /* sequence starts in month 1.
+        compute nepisode=nepisode+1.
+        compute start(nepisode)=#i.
+        compute #new=1.
+     else if (#i eq totmonths). /* sequence ends in last month.
+        compute duration(nepisode)=#i-start(nepisode)+1.
+        compute #new=0.
+     else.
+        do if (months(#i-1) eq 0 and months(#i+1) eq 0). /* '010' sequence.
+           compute nepisode=nepisode+1.
+           compute start(nepisode)=#i.
+           compute duration(nepisode)=1.
+        else.
+           do if (#new eq 0). /* start of episode.
+              compute nepisode=nepisode+1.
+              compute start(nepisode)=#i.
+              compute #new=1.
+           else if (#new eq 1). /* end of episode.
+              compute duration(nepisode)=#i-start(nepisode)+1.
+              compute #new=0.
+           end if.
+        end if.
+     end if.
+  end if.
end loop.
execute.

print / start1 to start10 duration1 to duration10.
execute.

=====================
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: Life History Calendar Data

Bruce Weaver
Administrator
I was intrigued by these lines from Gene's syntax:

String months(a60).
Do repeat m=m1 to m60/i=1 to 60.
+  compute substr(months,i,1)=string(m,f1.0).
End repeat.

I did not know one could do that with SUBSTR.  Neat trick.  Thanks for educating me, Gene.

Bruce

Gene Maguin wrote
Laneah,

Here is my proposed code. I have tested it and I think it works correctly.
Note that it assumes that the value for the first and last months is 0 or 1.
2s will cause problems. If you wish, I can do more when you resolve how to
count episodes and durations at the beginning and end of the sequence. For
test purposes I used just 60 months. You will need to adjust the code to
reflect your number of months.


data list / m1 to m60 (60f1.0).
begin data
000010000122221000000110000110101222222222222100000101012221
110010000122221000000110000110101222222222222100000101000000
122210000122221000000110000110101222222222222100000101010110
end data.


*  number of episodes.
Format m1 to m60(f1.0).
Recode m1 to m60(sysmis=9).
String months(a60).
Do repeat m=m1 to m60/i=1 to 60.
+  compute substr(months,i,1)=string(m,f1.0).
End repeat.

Compute singles=0.
Loop #i=1 to 58.
+  if (substr(months,#i,3) eq '010') singles=singles+1.
End loop.
*  then this from above.
Count episodes=m1 to m60(1).
Compute episodes=((episodes-singles)/2)+singles.

descriptives episodes/statistics max.
*  the value returned here is used to define the length of the
*  start and duration vectors.

delete variables months.

*  10 episodes found.
vector start(10,f2.0) duration(10,f2.0).
vector months=m1 to m60. /* change 60 to your value throughout.
compute totmonths=60.
compute nepisode=0.
loop #i=1 to 60.
+  do if (months(#i) eq 1).
+     do if (#i eq 1). /* sequence starts in month 1.
+        compute nepisode=nepisode+1.
+        compute start(nepisode)=#i.
+        compute #new=1.
+     else if (#i eq totmonths). /* sequence ends in last month.
+        compute duration(nepisode)=#i-start(nepisode)+1.
+        compute #new=0.
+     else.
+        do if (months(#i-1) eq 0 and months(#i+1) eq 0). /* '010' sequence.
+           compute nepisode=nepisode+1.
+           compute start(nepisode)=#i.
+           compute duration(nepisode)=1.
+        else.
+           do if (#new eq 0). /* start of episode.
+              compute nepisode=nepisode+1.
+              compute start(nepisode)=#i.
+              compute #new=1.
+           else if (#new eq 1). /* end of episode.
+              compute duration(nepisode)=#i-start(nepisode)+1.
+              compute #new=0.
+           end if.
+        end if.
+     end if.
+  end if.
end loop.
execute.

print / start1 to start10 duration1 to duration10.
execute.

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Order don't answer to the final row in custom table

Arthur Burke
In reply to this post by Auberth Hurtado
Auberth ... Does this do what you want?

CTABLES
  /VLABELS VARIABLES=P1 DISPLAY=LABEL
  /TABLE P1 [C][COUNT F40.0]
  /CATEGORIES VARIABLES=P1 [1.00, 2.00, 3.00, 9.00] EMPTY=EXCLUDE
TOTAL=YES POSITION=AFTER.

Art
------------------------------------------------------------------
Art Burke
Evaluation Advisor
Northwest Regional Educational Laboratory
101 SW Main St, Suite 500
Portland, OR 97204-3213
Phone:  503-275-9592 / 800-547-6339
Fax: 503-275-0450
[hidden email]
www.nwrel.org


-----Original Message-----
From: Auberth Hurtado [mailto:[hidden email]]
Sent: Friday, August 14, 2009 2:03 PM
To: [hidden email]
Subject: Order don't answer to the final row in custom table

Hi all, I find the answer category (9) at the end of the custom table,
for
example:

DATA LIST FREE/P1.
BEGIN DATA
1 1 1 1 9 9 9 2 2 3
END DATA.

VAL LAB P1
1 'E'
2 'R'
3 'B'
9 'DA' .

CTABLES
  /VLABELS VARIABLES=P1 DISPLAY=DEFAULT
  /TABLE P1 [C][COUNT F40.0]
  /CATEGORIES VARIABLES=P1 ORDER=D KEY=COUNT EMPTY=INCLUDE TOTAL=YES
POSITION=AFTER.


The table looks like:

                Count
P1      E       4
        DA      3
        R       2
        B       1
        Total   10

And I want:

                Count
P1      E       4
        R       2
        B       1
        DA      3
        Total   10

how do I do that?, Thanks for your help.

Auberth.

=====================
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: Life History Calendar Data

Peck, Jon
In reply to this post by Bruce Weaver
You can insert on the left hand side with the substr function, but if your string text involves extended or multi-byte characters, be careful.  Since characters are variable length in either multibyte code pages or Unicode, you can't be sure of fitting the characters in the expected space.  The substr function works on bytes, not characters, so you can use it on the left if you are careful, but the newer char.substr function does not allow that because it is character oriented, and characters require a variable number of bytes in Unicode mode.  Using substr in this way, therefore, will create problems if and when you switch to Unicode mode.

Regards,
Jon Peck

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Bruce Weaver
Sent: Monday, August 17, 2009 1:35 PM
To: [hidden email]
Subject: Re: [SPSSX-L] Life History Calendar Data

I was intrigued by these lines from Gene's syntax:

String months(a60).
Do repeat m=m1 to m60/i=1 to 60.
+  compute substr(months,i,1)=string(m,f1.0).
End repeat.

I did not know one could do that with SUBSTR.  Neat trick.  Thanks for
educating me, Gene.

Bruce


Gene Maguin wrote:

>
> Laneah,
>
> Here is my proposed code. I have tested it and I think it works correctly.
> Note that it assumes that the value for the first and last months is 0 or
> 1.
> 2s will cause problems. If you wish, I can do more when you resolve how to
> count episodes and durations at the beginning and end of the sequence. For
> test purposes I used just 60 months. You will need to adjust the code to
> reflect your number of months.
>
>
> data list / m1 to m60 (60f1.0).
> begin data
> 000010000122221000000110000110101222222222222100000101012221
> 110010000122221000000110000110101222222222222100000101000000
> 122210000122221000000110000110101222222222222100000101010110
> end data.
>
>
> *  number of episodes.
> Format m1 to m60(f1.0).
> Recode m1 to m60(sysmis=9).
> String months(a60).
> Do repeat m=m1 to m60/i=1 to 60.
> +  compute substr(months,i,1)=string(m,f1.0).
> End repeat.
>
> Compute singles=0.
> Loop #i=1 to 58.
> +  if (substr(months,#i,3) eq '010') singles=singles+1.
> End loop.
> *  then this from above.
> Count episodes=m1 to m60(1).
> Compute episodes=((episodes-singles)/2)+singles.
>
> descriptives episodes/statistics max.
> *  the value returned here is used to define the length of the
> *  start and duration vectors.
>
> delete variables months.
>
> *  10 episodes found.
> vector start(10,f2.0) duration(10,f2.0).
> vector months=m1 to m60. /* change 60 to your value throughout.
> compute totmonths=60.
> compute nepisode=0.
> loop #i=1 to 60.
> +  do if (months(#i) eq 1).
> +     do if (#i eq 1). /* sequence starts in month 1.
> +        compute nepisode=nepisode+1.
> +        compute start(nepisode)=#i.
> +        compute #new=1.
> +     else if (#i eq totmonths). /* sequence ends in last month.
> +        compute duration(nepisode)=#i-start(nepisode)+1.
> +        compute #new=0.
> +     else.
> +        do if (months(#i-1) eq 0 and months(#i+1) eq 0). /* '010'
> sequence.
> +           compute nepisode=nepisode+1.
> +           compute start(nepisode)=#i.
> +           compute duration(nepisode)=1.
> +        else.
> +           do if (#new eq 0). /* start of episode.
> +              compute nepisode=nepisode+1.
> +              compute start(nepisode)=#i.
> +              compute #new=1.
> +           else if (#new eq 1). /* end of episode.
> +              compute duration(nepisode)=#i-start(nepisode)+1.
> +              compute #new=0.
> +           end if.
> +        end if.
> +     end if.
> +  end if.
> end loop.
> execute.
>
> print / start1 to start10 duration1 to duration10.
> execute.
>
> =====================
> 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
>
>


-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."

NOTE:  My hotmail address is for posting only, and messages sent to it will
be deleted.

--
View this message in context: http://www.nabble.com/Life-History-Calendar-Data-tp24930048p25012815.html
Sent from the SPSSX Discussion mailing list archive at 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

=====================
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: Life History Calendar Data

Maguin, Eugene
Jon,

I have a couple of questions that I hope you can answer or point to a source
for useful information. With respect to your reply to Bruce.

Can you say categorically that as long as you work only in english and,
maybe more specifically, the standard english keyboard, that there will
never be a problem with extended/multibyte characters? (Since I know hardly
nothing about this, I'm not even sure how to ask a knowledgable question.)

If not, where are the boundaries where troubles will arise and how will you
know if troubles do arise?

Second, it seems to that word 2003 creates characters that are not in the
character set in the appendix of the CSR (I'm thinking, for example, of
those pretty but useless 'smart quotes', which stay around when the file is
converted to text, and the like and not things that come from the insert
symbol menus.) Where is documentation for these character sets. It used to
be that spss was useful to parse text strings for non alpha characters but
now I'm not so sure that is possible anymore because characters can't be
identified even though they are visible. Can you comment?

Gene Maguin










You can insert on the left hand side with the substr function, but if your
string text involves extended or multi-byte characters, be careful.  Since
characters are variable length in either multibyte code pages or Unicode,
you can't be sure of fitting the characters in the expected space.  The
substr function works on bytes, not characters, so you can use it on the
left if you are careful, but the newer char.substr function does not allow
that because it is character oriented, and characters require a variable
number of bytes in Unicode mode.  Using substr in this way, therefore, will
create problems if and when you switch to Unicode mode.

Regards,
Jon Peck

=====================
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: Life History Calendar Data

Peck, Jon
See below.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Gene Maguin
Sent: Monday, August 17, 2009 2:28 PM
To: [hidden email]
Subject: Re: [SPSSX-L] Life History Calendar Data

Jon,

I have a couple of questions that I hope you can answer or point to a source
for useful information. With respect to your reply to Bruce.

Can you say categorically that as long as you work only in english and,
maybe more specifically, the standard english keyboard, that there will
never be a problem with extended/multibyte characters? (Since I know hardly
nothing about this, I'm not even sure how to ask a knowledgable question.)
[peck] You mean like Scheffé?
If you and those you exchange syntax or data with will always use only 7-bit ascii (a-z, A-Z, 0-9, common punctuation, blank, some other things), you will never need Unicode.  Even then, you might want to use that mode for the improvements in some of the char. functions we added and behavior changes in Unicode mode such as the automatic rtrim in char.length and character retrievals.

Since most major software has gone to Unicode (you are always in Unicode in MS Office, for example), it is possible that traditional character sets will eventually go away or have only limited support.  Since version 16, the SPSS frontend has, in fact, operated exclusively in Unicode, although with plain roman characters you would never know it.

If not, where are the boundaries where troubles will arise and how will you
know if troubles do arise?
[peck] Mostly, Unicode solves problems rather than creating them, but if you are dealing with a character standard that supports over 100,000 characters, there are some complications.  Within Statistics, you will generally be warned about character problems if the system has sufficient information to detect them

Second, it seems to that word 2003 creates characters that are not in the
character set in the appendix of the CSR (I'm thinking, for example, of
those pretty but useless 'smart quotes', which stay around when the file is
converted to text, and the like and not things that come from the insert
symbol menus.) Where is documentation for these character sets. It used to
be that spss was useful to parse text strings for non alpha characters but
now I'm not so sure that is possible anymore because characters can't be
identified even though they are visible. Can you comment?
[peck]Word is using the Unicode representation of these characters.  Statistics will, too, in Unicode mode, and it will be able to display them correctly.  In the traditional code page mode, using the Windows character set you are familiar with (known as code page 1252), characters in that code page will be okay.  You can see the characters in that set here:
http://en.wikipedia.org/wiki/Windows-1252

The appendix you refer to is only relevant for the portable file format, which is little used anymore, I believe.

HTH,
p.s. Character sets and encodings seems like something that should be simple, but this is an area of major confusion for software developers as well as users.

Gene Maguin










You can insert on the left hand side with the substr function, but if your
string text involves extended or multi-byte characters, be careful.  Since
characters are variable length in either multibyte code pages or Unicode,
you can't be sure of fitting the characters in the expected space.  The
substr function works on bytes, not characters, so you can use it on the
left if you are careful, but the newer char.substr function does not allow
that because it is character oriented, and characters require a variable
number of bytes in Unicode mode.  Using substr in this way, therefore, will
create problems if and when you switch to Unicode mode.

Regards,
Jon Peck

=====================
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: Order don't answer to the final row in custom table

Auberth Hurtado
In reply to this post by Arthur Burke
Ok Arthur thanks, but I want to sort the categories in descending order by
count.

Auberth.

-----Mensaje original-----
De: SPSSX(r) Discussion [mailto:[hidden email]] En nombre de
Arthur Burke
Enviado el: Lunes, 17 de Agosto de 2009 02:38 p.m.
Para: [hidden email]
Asunto: Re: Order don't answer to the final row in custom table

Auberth ... Does this do what you want?

CTABLES
  /VLABELS VARIABLES=P1 DISPLAY=LABEL
  /TABLE P1 [C][COUNT F40.0]
  /CATEGORIES VARIABLES=P1 [1.00, 2.00, 3.00, 9.00] EMPTY=EXCLUDE
TOTAL=YES POSITION=AFTER.

Art
------------------------------------------------------------------
Art Burke
Evaluation Advisor
Northwest Regional Educational Laboratory
101 SW Main St, Suite 500
Portland, OR 97204-3213
Phone:  503-275-9592 / 800-547-6339
Fax: 503-275-0450
[hidden email]
www.nwrel.org


-----Original Message-----
From: Auberth Hurtado [mailto:[hidden email]]
Sent: Friday, August 14, 2009 2:03 PM
To: [hidden email]
Subject: Order don't answer to the final row in custom table

Hi all, I find the answer category (9) at the end of the custom table,
for
example:

DATA LIST FREE/P1.
BEGIN DATA
1 1 1 1 9 9 9 2 2 3
END DATA.

VAL LAB P1
1 'E'
2 'R'
3 'B'
9 'DA' .

CTABLES
  /VLABELS VARIABLES=P1 DISPLAY=DEFAULT
  /TABLE P1 [C][COUNT F40.0]
  /CATEGORIES VARIABLES=P1 ORDER=D KEY=COUNT EMPTY=INCLUDE TOTAL=YES
POSITION=AFTER.


The table looks like:

                Count
P1      E       4
        DA      3
        R       2
        B       1
        Total   10

And I want:

                Count
P1      E       4
        R       2
        B       1
        DA      3
        Total   10

how do I do that?, Thanks for your help.

Auberth.

=====================
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: Life History Calendar Data

Laneah
In reply to this post by Maguin, Eugene
Gene,

Thanks a bunch! This seems to work nicely. Thanks for giving me writeup that follows from beginning to end. When I get the larger study published I will be sure to recognize your assistance. Let me know if there is a certian way that you would like this done (e.g. affiliation?). Now I'll have the pleasure of digging through your syntax and figuring out how you made this work.

Thanks,

Laneah

P.S. Being new to Nabble and not knowing what to expect I used Laneah for my pseudonymn.


Gene Maguin wrote
Laneah,

Here is my proposed code. I have tested it and I think it works correctly.
Note that it assumes that the value for the first and last months is 0 or 1.
2s will cause problems. If you wish, I can do more when you resolve how to
count episodes and durations at the beginning and end of the sequence. For
test purposes I used just 60 months. You will need to adjust the code to
reflect your number of months.


data list / m1 to m60 (60f1.0).
begin data
000010000122221000000110000110101222222222222100000101012221
110010000122221000000110000110101222222222222100000101000000
122210000122221000000110000110101222222222222100000101010110
end data.


*  number of episodes.
Format m1 to m60(f1.0).
Recode m1 to m60(sysmis=9).
String months(a60).
Do repeat m=m1 to m60/i=1 to 60.
+  compute substr(months,i,1)=string(m,f1.0).
End repeat.

Compute singles=0.
Loop #i=1 to 58.
+  if (substr(months,#i,3) eq '010') singles=singles+1.
End loop.
*  then this from above.
Count episodes=m1 to m60(1).
Compute episodes=((episodes-singles)/2)+singles.

descriptives episodes/statistics max.
*  the value returned here is used to define the length of the
*  start and duration vectors.

delete variables months.

*  10 episodes found.
vector start(10,f2.0) duration(10,f2.0).
vector months=m1 to m60. /* change 60 to your value throughout.
compute totmonths=60.
compute nepisode=0.
loop #i=1 to 60.
+  do if (months(#i) eq 1).
+     do if (#i eq 1). /* sequence starts in month 1.
+        compute nepisode=nepisode+1.
+        compute start(nepisode)=#i.
+        compute #new=1.
+     else if (#i eq totmonths). /* sequence ends in last month.
+        compute duration(nepisode)=#i-start(nepisode)+1.
+        compute #new=0.
+     else.
+        do if (months(#i-1) eq 0 and months(#i+1) eq 0). /* '010' sequence.
+           compute nepisode=nepisode+1.
+           compute start(nepisode)=#i.
+           compute duration(nepisode)=1.
+        else.
+           do if (#new eq 0). /* start of episode.
+              compute nepisode=nepisode+1.
+              compute start(nepisode)=#i.
+              compute #new=1.
+           else if (#new eq 1). /* end of episode.
+              compute duration(nepisode)=#i-start(nepisode)+1.
+              compute #new=0.
+           end if.
+        end if.
+     end if.
+  end if.
end loop.
execute.

print / start1 to start10 duration1 to duration10.
execute.

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (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
12