Building on earlier code

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

Building on earlier code

J.D. Haltigan
In a previous thread I received much appreciated assistance with developing
code using scratch variables to create an index variable that identifies
whether or not a participants DOB or DOB-1(yr) UNIQUELY matches one of a set
of 12 different variables that take the form PREGYEAR1....PREGYEAR12. Using
this code I was able to clean the data and ask about cases where no UNIQUE
match was present (there should be) or where there was more than one UNIQUE
match (in the case of say twins).

I have a more complex coding question, now, however. For each PREGYEAR1...12
variables, there are associated variable sets taking the form BABY1BW_LBS
BABY1BW_KG BABY1BW_OZ....BABY12(same 3). I need to develop code such that
when the participant's DOB or DOB-1 UNIQUELY matches a PREGYEAR(k) variable
(which I have done), the code computes the associated BW variables
associated with that PREGYEAR (for that case). ****In other words, I end up
with the participant's BW variables for each case.****

As an arbitrary example: participant's DOB or DOB-1 matches the PREGYEAR5
variable, I need (for that case) the BABY5BW_ set of 3 variables described
above (_LBS _KG _OZ). Similarly, participant's DOB or DOB-1 matches, say,
the PREGYEAR3 variable, I need (for that case) the BABY3BW_set of 3
variables.

I also need the code to only be executed if associated LIVEBIRTHBABY1...12 =
TRUE (1).

I tried a few different instantiations using scratch variables, but
encountered difficult with multiple scratch variables at one time. Further,
I began to wonder if it would be more efficient just to select cases on
LIVEBIRTH = TRUE and then run code and/or to extract a portion of the data
including the concerned questionnaire and somehow restructure it to make it
simpler (could then merge back in the 3 desired variables for each case).

Any thoughts on how to go about this would be most appreciated. It's a pity
that when the data was collected a PARTICIPANT_BW variable was not created,
but this is what I have to do to get what are very important proband BW
variables for our research questions.



--
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: Building on earlier code

David Marso
Administrator
You would do well to provide a data snippet with a play by play rational.
Q. Where does one draw the line in the sand and resist providing free
advice?
A. When it takes me longer than 5 minutes to sort out the details of the
question.


J.D. Haltigan wrote

> In a previous thread I received much appreciated assistance with
> developing
> code using scratch variables to create an index variable that identifies
> whether or not a participants DOB or DOB-1(yr) UNIQUELY matches one of a
> set
> of 12 different variables that take the form PREGYEAR1....PREGYEAR12.
> Using
> this code I was able to clean the data and ask about cases where no UNIQUE
> match was present (there should be) or where there was more than one
> UNIQUE
> match (in the case of say twins).
>
> I have a more complex coding question, now, however. For each
> PREGYEAR1...12
> variables, there are associated variable sets taking the form BABY1BW_LBS
> BABY1BW_KG BABY1BW_OZ....BABY12(same 3). I need to develop code such that
> when the participant's DOB or DOB-1 UNIQUELY matches a PREGYEAR(k)
> variable
> (which I have done), the code computes the associated BW variables
> associated with that PREGYEAR (for that case). ****In other words, I end
> up
> with the participant's BW variables for each case.****
>
> As an arbitrary example: participant's DOB or DOB-1 matches the PREGYEAR5
> variable, I need (for that case) the BABY5BW_ set of 3 variables described
> above (_LBS _KG _OZ). Similarly, participant's DOB or DOB-1 matches, say,
> the PREGYEAR3 variable, I need (for that case) the BABY3BW_set of 3
> variables.
>
> I also need the code to only be executed if associated LIVEBIRTHBABY1...12
> =
> TRUE (1).
>
> I tried a few different instantiations using scratch variables, but
> encountered difficult with multiple scratch variables at one time.
> Further,
> I began to wonder if it would be more efficient just to select cases on
> LIVEBIRTH = TRUE and then run code and/or to extract a portion of the data
> including the concerned questionnaire and somehow restructure it to make
> it
> simpler (could then merge back in the 3 desired variables for each case).
>
> Any thoughts on how to go about this would be most appreciated. It's a
> pity
> that when the data was collected a PARTICIPANT_BW variable was not
> created,
> but this is what I have to do to get what are very important proband BW
> variables for our research questions.





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Building on earlier code

J.D. Haltigan
Fair, David. I was afraid I might get some push back of your sort. Can
totally understand if folks do not want to provide expertise if they do not
have the time or feel poster has not done due diligence. I can assure you I
have. Tried to also make the details as str8forward as possible.

That said, it is not clear to me what kind of data snippet works best here,
nor what other play by play I could provide besides which I have already
done.

I'll do whatever I can to generate insight or continue to grind it out and
may even go manual in getting the info if I have to. But have learned a lot
here and am very appreciative to those who chime in.



--
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: Building on earlier code

Maguin, Eugene
I agree with David. Some example data would help visualize the problem. A for instance is, given your description, a person could/would assume that all that data is sitting in one files. And maybe it's all on one record per 'unit', whatever 'unit' might be. If that is true, then the structure of that file is important to understand. But, on the other hand, maybe you're putting together multiple files, a 'unit' file, a birth DOB and weight file, and a birth status (live or not) file.
Gene Maguin

-----Original Message-----
From: SPSSX(r) Discussion <[hidden email]> On Behalf Of J.D. Haltigan
Sent: Tuesday, June 4, 2019 4:57 PM
To: [hidden email]
Subject: Re: Building on earlier code

Fair, David. I was afraid I might get some push back of your sort. Can totally understand if folks do not want to provide expertise if they do not have the time or feel poster has not done due diligence. I can assure you I have. Tried to also make the details as str8forward as possible.

That said, it is not clear to me what kind of data snippet works best here, nor what other play by play I could provide besides which I have already done.

I'll do whatever I can to generate insight or continue to grind it out and may even go manual in getting the info if I have to. But have learned a lot here and am very appreciative to those who chime in.



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

=====================
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: Building on earlier code

J.D. Haltigan
So this is the key data snippit that exemplifies the situation. This
structure is repeated 12 times to reflect 12 possible pregnancies for each
case (i.e., the proband). If you mentally can envision SUBJECTID SUBJECTDOB
and SUBJECTDOB-1 as three variables to the left of this, you have the data
visualization.

<http://spssx-discussion.1045642.n5.nabble.com/file/t340857/Untitled.jpg>



--
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: Building on earlier code

David Marso
Administrator
In reply to this post by J.D. Haltigan
"I tried a few different instantiations using scratch variables, but
encountered difficult with multiple scratch variables at one time. "

Scratch variables? To what  end?
Please look up the DO REPEAT and DO IF commands.
Too bad your data are wide and common variables are not contiguous.
Horrible data structure IMNSO. Total PITA to code to.
Further more you would do well to post your current syntax attempts along
with a post mortum.
BTW: That data snippet you posted is basically useless in helping us to
understand your plight.



-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Building on earlier code

J.D. Haltigan
Already have with DO REPEAT AND DO IF and playing with them for a while. I'll
grind through it.

BTW: data structure not of my doing.

Will put out the flames from this burn and next post will have all of the
info you requested.



--
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: Building on earlier code

David Marso
Administrator
"BTW: data structure not of my doing."
But NOT leaving it as it is IS completely under your control?

GET FILE..../KEEP  IDVariables {rational order of variables appropriate for
use of TO keyword} ALL.
SAVE OUTFILE=<Non_FUBAR_DataFile.sav>.

Building out a LONG version might also be advisable/useful for various
purposes.
VARSTOCASES /ID =ExistingUniqueRowIdentifier(s)
 /MAKE valuesA FROM Set_A_01 TO  Set_A_12
 /MAKE valuesB FROM Set_B_01 TO  Set_B_12
…...
 /MAKE valuesP FROM Set_P_01 TO  Set_P_12
 /INDEX=NewVariable
……...







J.D. Haltigan wrote

> Already have with DO REPEAT AND DO IF and playing with them for a while.
> I'll
> grind through it.
>
> BTW: data structure not of my doing.
>
> Will put out the flames from this burn and next post will have all of the
> info you requested.
>
>
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> 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





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Building on earlier code

J.D. Haltigan
Would make little sense in this case to restructure the data, though I
appreciate the thought. In fact, I considered extracting just this measure
and restructuring this subdataset given the nestedness of the measure. But
that would be inefficient, I think.

I have made headway thinking it through with scratch variables and DO
REPEAT.

Will report back soon with relevant post-mortems, syntax, and so forth as
advised if I encounter in ability to get where I need to go which is likely.



--
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: Building on earlier code

David Marso
Administrator
"I have made headway thinking it through with scratch variables and DO
REPEAT."

As I previously stated, scratch variables are irrelevant here.  
Please post the faulty DO REPEAT code.

Actually, if you do the VARSTOCASES, the solution will slap you upside the
head -facepalm time-.  At any rate the variable reordering is certainly
mandatory.  If you think otherwise you should perhaps  provide a valid
reason for continuing to work with the file in its current clumsy structure.
Perhaps consider my 30+ years of experience?  At this point I don't really
give a damn.

 I am assuming that only one set satisfies the identification criteria.
Otherwise the original question makes no sense as stated.  Do the
restructuring and the solution will simply emerge like magic.


J.D. Haltigan wrote

> Would make little sense in this case to restructure the data, though I
> appreciate the thought. In fact, I considered extracting just this measure
> and restructuring this subdataset given the nestedness of the measure. But
> that would be inefficient, I think.
>
> I have made headway thinking it through with scratch variables and DO
> REPEAT.
>
> Will report back soon with relevant post-mortems, syntax, and so forth as
> advised if I encounter in ability to get where I need to go which is
> likely.



























-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Building on earlier code

J.D. Haltigan
I appreciate your insight and your engagement, David. You seem a bit annoyed
with a clown like me but I appreciate that

In all seriousness, not at all ignoring your 30+ years. I come back for the
scolding as I value your expertise. For now, I need to struggle with this a
bit on my own. The reason I have not restructured is that the dataset is
large (3k plus vars). Moreover, I have to stay wide at the moment b/c of
subsequent analyses in R which need a wide set.

I have some code I will up soon as I know I am not going to be able to pull
this off without the expertise of folks here.

Cheers man!



--
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: Building on earlier code

David Marso-2
In reply to this post by J.D. Haltigan
Use KEEP on your GET FILE to retain only the required subset.  Restructure and MATCH.  There is no requirement that all the data be all together all of the time.  Need to wrap your brain around the idea that "long" and "wide" are merely transient states and that data are like plastic.

=====================
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: Building on earlier code

Rich Ulrich
In reply to this post by J.D. Haltigan
I know that I want to deal with 3K plus variables as little as
possible.  Edit-checks and manipulations of many kinds are
much easier in long-form rather than wide-form. "Easier"
means both easier to code and easier to check. I never want
to scan 3K variables  for scores-in-range or outliers. Too tedious.
And error-prone.  And too many pages of output to scan.

Make a working file with only the variables that are repeated, and
write it long instead of wide.  Another file holds the once-only data.
And you might drop some repeated vars if they are not immediately
needed (note, that risks needing to re-do when a PI expands his aims).


If you want the file WIDE for some eventual analysis, make a file
in that format when you are done with the tedious part. That's
simple enough to do: casestovars, then match to one-time vars.

--
Rich Ulrich


From: SPSSX(r) Discussion <[hidden email]> on behalf of J.D. Haltigan <[hidden email]>
Sent: Thursday, June 6, 2019 1:59 AM
To: [hidden email]
Subject: Re: Building on earlier code
 
I appreciate your insight and your engagement, David. You seem a bit annoyed
with a clown like me but I appreciate that

In all seriousness, not at all ignoring your 30+ years. I come back for the
scolding as I value your expertise. For now, I need to struggle with this a
bit on my own. The reason I have not restructured is that the dataset is
large (3k plus vars). Moreover, I have to stay wide at the moment b/c of
subsequent analyses in R which need a wide set.

I have some code I will up soon as I know I am not going to be able to pull
this off without the expertise of folks here.

Cheers man!



--
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
===================== 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: Building on earlier code

J.D. Haltigan
Yes, the 'analytic file' is going to be a pared down file of course. For now,
I have to select the analytic variables we are using from a much larger
item-wise etc. file.

Part of my strategy to start is to copy variables we are using in the
analyses to the end of the working file with a new variable name that is
just an underscore added to the original. In some cases we need to perform
transformations etc. from a wide array of different health/diagnostic
variables. At any rate, the eventual variables we will KEEP are all at the
end of the working file and then I will DROP when I am ready.

In the case of the situation I am now dealing with, the only tractable way
to handle the situation may be to extract that measure as a separate entity
and restructure as suggested.

Not nearly as savvy to rip off a restructure using syntax like David et al.
So learning here...almost to the point where I do just about everything in
syntax but then I start using Mplus and R and lose some of the SPSS sense...



--
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: Building on earlier code

Jon Peck
From the CSR ...
Variable names ending in underscores should be avoided, since such names may conflict with names of
variables automatically created by commands and procedures.

On Thu, Jun 6, 2019 at 2:31 PM J.D. Haltigan <[hidden email]> wrote:
Yes, the 'analytic file' is going to be a pared down file of course. For now,
I have to select the analytic variables we are using from a much larger
item-wise etc. file.

Part of my strategy to start is to copy variables we are using in the
analyses to the end of the working file with a new variable name that is
just an underscore added to the original. In some cases we need to perform
transformations etc. from a wide array of different health/diagnostic
variables. At any rate, the eventual variables we will KEEP are all at the
end of the working file and then I will DROP when I am ready.

In the case of the situation I am now dealing with, the only tractable way
to handle the situation may be to extract that measure as a separate entity
and restructure as suggested.

Not nearly as savvy to rip off a restructure using syntax like David et al.
So learning here...almost to the point where I do just about everything in
syntax but then I start using Mplus and R and lose some of the SPSS sense...



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


--
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: Building on earlier code

J.D. Haltigan
Should have been more clear, Jon....the new variable is the same variable
with an _ + a unique three letter extension that indicates it is the
analytic variable. Usually I just use investigator initials depending.

So---not just an underscore for the reasons you point out.



--
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: Building on earlier code

J.D. Haltigan
Save file KEEP worked to pare down the file as needed.

As it turns out, after thinking this through, short of a manual data entry
fix I don't see how syntax can help right now.

To provide a sense:

Data is wide, each row reflects a proband case (measures of functioning
etc.).
There is a measure on which the proband's caregiver reports her total #of
pregnancies, each birth year associated with that pregnancy, and health
variables for the newborn. The caregiver can report up to 12 pregnancies and
the variables are all of the same form (PREG1 PREGYEAR1 BABYLBS1...THRU 12).

The issue is this: of those 12 possibilities, one reflects the proband but
there is no unique identifier that would allow me to (for each case) select
on a variable and then compute new variables for BABYLBS etc. FOR ONLY THE
PROBAND (i.e., the case reflected in the row). This is because any of the 12
PREGYEARS could be the proband. I have with the help of the board created a
'unique' identifier variable which identifies whether there is OR NOT a
relevant set of pregnancy variables for the proband (by matching the
proband's DOB or DOB-1 with the PREGYEAR variables), but I don't see how I
could select the health variables on a case by case basis since they may
well be PREGYEAR3 variables or PREGYEAR2 variables etc.

EVEN IF I restructure to within, I'm not sure what the index variable then
becomes and even with one, whether I could set up syntax that would select
the proband's birth data based on the way the variables are currently named
etc (nothing is unique).

So rather than get burned by posting code that is a waste of time, perhaps
some insight into how one would characterize this particular data structure
(it's panel data that is cross-sectional) since it's wide, but this measure
is technically a repeated measure. It's almost like a within-subjects factor
embedded in a between-subjects data structure.



--
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: Building on earlier code

David Marso
Administrator
This post was updated on .
"As it turns out, after thinking this through, short of a manual data entry
fix I don't see how syntax can help right now."

I call Bullshit. If it can be sorted out manually then it can be done
programatically with syntax.

I don't understand your description (too much specialized jargon) and you
have not shown us any data illustrating any specific issues.  Perhaps attach
a row of actual problematic data with a detailed unpacking of the
showstopper attributes as well as a description of how you would perform a
"manual data entry fix".
Nabble allows attachments. DO NOT FFS ATTACH A GRAHICAL SCREEN CAPTURE. THEY
ARE USELESS.

http://spssx-discussion.1045642.n5.nabble.com/Building-on-earlier-code-td5738010.html#a5738033





J.D. Haltigan wrote
> Save file KEEP worked to pare down the file as needed.
>
> As it turns out, after thinking this through, short of a manual data entry
> fix I don't see how syntax can help right now.
>
> To provide a sense:
>
> Data is wide, each row reflects a proband case (measures of functioning
> etc.).
> There is a measure on which the proband's caregiver reports her total #of
> pregnancies, each birth year associated with that pregnancy, and health
> variables for the newborn. The caregiver can report up to 12 pregnancies
> and
> the variables are all of the same form (PREG1 PREGYEAR1 BABYLBS1...THRU
> 12).
>
> The issue is this: of those 12 possibilities, one reflects the proband but
> there is no unique identifier that would allow me to (for each case)
> select
> on a variable and then compute new variables for BABYLBS etc. FOR ONLY THE
> PROBAND (i.e., the case reflected in the row). This is because any of the
> 12
> PREGYEARS could be the proband. I have with the help of the board created
> a
> 'unique' identifier variable which identifies whether there is OR NOT a
> relevant set of pregnancy variables for the proband (by matching the
> proband's DOB or DOB-1 with the PREGYEAR variables), but I don't see how I
> could select the health variables on a case by case basis since they may
> well be PREGYEAR3 variables or PREGYEAR2 variables etc.
>
> EVEN IF I restructure to within, I'm not sure what the index variable then
> becomes and even with one, whether I could set up syntax that would select
> the proband's birth data based on the way the variables are currently
> named
> etc (nothing is unique).
>
> So rather than get burned by posting code that is a waste of time, perhaps
> some insight into how one would characterize this particular data
> structure
> (it's panel data that is cross-sectional) since it's wide, but this
> measure
> is technically a repeated measure. It's almost like a within-subjects
> factor
> embedded in a between-subjects data structure.
>
>
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> 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





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Building on earlier code

Maguin, Eugene
In reply to this post by J.D. Haltigan
I now have a better understanding of your (impossible) problem. I don't know if this is correct but it seems that you have data from two sources: mother and an offspring. It also sounds like these two data sources are combined into one record. Perhaps you've done this already but I'd like to know how many cases have a match of mother report birth year and child DOB year. I'll guess you will find two cases: child DOB year matches exactly one mother report birth year or child DOB year matches several mother report birth years. (The exact wording of the mother birth years question matters as well as the unknowable mother interpretation of the question as well as her recall accuracy. Also, perhaps whether the target offspring was a twin or more.) The file could be split at this point into case 1 and case 2 records. I think the case 1 records can be easily massaged into shape and Done (I don't intend this to mean that there could not be errors, thus mismatches; there could be but I'd say they are unknowable given available information).  The case 2 records are the problem. For these records, it would be good to know the differences between the child DOB year and the mother report years. The problem now isn't data management per se but an analysis problem of representing the consequences of the variability in the match variable.

Gene Maguin

-----Original Message-----
From: SPSSX(r) Discussion <[hidden email]> On Behalf Of J.D. Haltigan
Sent: Friday, June 7, 2019 3:25 AM
To: [hidden email]
Subject: Re: Building on earlier code

Save file KEEP worked to pare down the file as needed.

As it turns out, after thinking this through, short of a manual data entry fix I don't see how syntax can help right now.

To provide a sense:

Data is wide, each row reflects a proband case (measures of functioning etc.).
There is a measure on which the proband's caregiver reports her total #of pregnancies, each birth year associated with that pregnancy, and health variables for the newborn. The caregiver can report up to 12 pregnancies and the variables are all of the same form (PREG1 PREGYEAR1 BABYLBS1...THRU 12).

The issue is this: of those 12 possibilities, one reflects the proband but there is no unique identifier that would allow me to (for each case) select on a variable and then compute new variables for BABYLBS etc. FOR ONLY THE PROBAND (i.e., the case reflected in the row). This is because any of the 12 PREGYEARS could be the proband. I have with the help of the board created a 'unique' identifier variable which identifies whether there is OR NOT a relevant set of pregnancy variables for the proband (by matching the proband's DOB or DOB-1 with the PREGYEAR variables), but I don't see how I could select the health variables on a case by case basis since they may well be PREGYEAR3 variables or PREGYEAR2 variables etc.

EVEN IF I restructure to within, I'm not sure what the index variable then becomes and even with one, whether I could set up syntax that would select the proband's birth data based on the way the variables are currently named etc (nothing is unique).

So rather than get burned by posting code that is a waste of time, perhaps some insight into how one would characterize this particular data structure (it's panel data that is cross-sectional) since it's wide, but this measure is technically a repeated measure. It's almost like a within-subjects factor embedded in a between-subjects data structure.



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

=====================
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: Building on earlier code

Bruce Weaver
Administrator
In reply to this post by David Marso
As David said, screen capture images of the data editor are not nearly as
helpful as a few lines of data that people can read in and play with (if
they wish).  If you post a DATA LIST command with a few lines of data, that
makes it much easier for others to help you.  See the first two (inline)
examples here for some guidance.

https://stats.idre.ucla.edu/spss/modules/how-to-read-raw-data-into-spss/

HTH.


David Marso wrote

> "As it turns out, after thinking this through, short of a manual data
> entry
> fix I don't see how syntax can help right now."
>
> I call Bullshit. If it can be sorted out manually then it can be done
> programatically with syntax.
>
> I don't understand your description (too much specialized jargon) and you
> have not shown us any data illustrating any specific issues.  Perhaps
> attach
> a row of actual problematic data with a detailed unpacking of the
> showstopper attributes as well as a description of how you would perform a
> "manual data entry fix".
> Nabble allows attachments. DO NOT FFS ATTACH A GRAHICAL SCREEN CAPTURE.
> THEY
> ARE USELESS.
>
> http://spssx-discussion.1045642.n5.nabble.com/Building-on-earlier-code-td5738010.html#a5738033





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
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
--
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/).
12