update make vars with casetovars varstocase

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

update make vars with casetovars varstocase

ChetMeinzer
I need to run a casetovars with ID Birthday, match on birthday, and then run vars to cases.  
This runs every night, and the data changes (i.e. some nights 20 people have the same birthday, others 100).  Thus, I need the “from var1 to var?” to update when the # duplicate birthdays change.

Pure SPSS solution is fine, but I have Python up and running too.

Here is what is happening (it crashes if/when bday data changes).

CASESTOVARS
  /ID=bday
  /GROUPBY=VARIABLE.

save outfile='k:/meinzer/temp/bdays.sav' /keep bday apsid.1 to apsid.6.

get file='k:\ClinfoX.sav'.
sort cases by Bday.
match files /table='k:/meinzer/temp/bdays.sav' /file=* /by Bday.

VARSTOCASES
  /MAKE apsid FROM APSid.1 to APSid.6
  /INDEX=Index1(6)
  /KEEP=bday fname Sex fname2 name ssn case lname
  /NULL=KEEP.

select if apsid gt 1.
save outfile='k:\temp\BdayMatch.sav' /keep apsid case .

Thank you,
Chet
Reply | Threaded
Open this post in threaded view
|

Re: update make vars with casetovars varstocase

David Marso
Administrator
After the CASETOVARS.
COMPUTE @=1.
Then:
Change apsid.6 to @ in the remaining.
See other options for INDEX in FM.


ChetStar wrote
I need to run a casetovars with ID Birthday, match on birthday, and then run vars to cases.  
This runs every night, and the data changes (i.e. some nights 20 people have the same birthday, others 100).  Thus, I need the “from var1 to var?” to update when the # duplicate birthdays change.

Pure SPSS solution is fine, but I have Python up and running too.

Here is what is happening (it crashes if/when bday data changes).

CASESTOVARS
  /ID=bday
  /GROUPBY=VARIABLE.

save outfile='k:/meinzer/temp/bdays.sav' /keep bday apsid.1 to apsid.6.

get file='k:\ClinfoX.sav'.
sort cases by Bday.
match files /table='k:/meinzer/temp/bdays.sav' /file=* /by Bday.

VARSTOCASES
  /MAKE apsid FROM APSid.1 to APSid.6
  /INDEX=Index1(6)
  /KEEP=bday fname Sex fname2 name ssn case lname
  /NULL=KEEP.

select if apsid gt 1.
save outfile='k:\temp\BdayMatch.sav' /keep apsid case .

Thank you,
Chet
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
|

Plotting to SPSS viewer from R

Garry Gelade
Dear List,

I am using the R programming interface (BEGIN PROGRAM R) to produce plots in the SPSS viewer.  The default aspect ratio is square, but I want a rectangular plot.  If I use the asp (aspect ratio) parameter in the R plot() command, the whole thing looks squashed up.

Does anyone know how to set the height and width of the plot so it appears correctly in the SPSS viewer?

Thanks

Garry

=====================
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: Plotting to SPSS viewer from R

David Marso
Administrator
Garry,
PLEASE begin a NEW thread rather than just changing the subject line!!!!!
Garry Gelade wrote
Dear List,

I am using the R programming interface (BEGIN PROGRAM R) to produce plots in the SPSS viewer.  The default aspect ratio is square, but I want a rectangular plot.  If I use the asp (aspect ratio) parameter in the R plot() command, the whole thing looks squashed up.

Does anyone know how to set the height and width of the plot so it appears correctly in the SPSS viewer?

Thanks

Garry

=====================
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: update make vars with casetovars varstocase

ChetMeinzer
In reply to this post by David Marso
Thank you David.  Great work around.
    You suggest:
"After the CASETOVARS.
COMPUTE @=1. "
    If I understand, @ =1 is intended to be a marker placed at then end of my list of make variables.  so If I have an ID of 1 in my final variable, this will not work, so perhaps using a bogus number is ideal e.g. -99.  Also, this requires that the variable list is sorted with id placed at the end (so @ really is the last variable).  Then, after varstocases, I should select if IDVAR ne (bogusvar of my choice)?

Finally, FM = Function Manual?  

It would be great to also have a python solution that is more flexible. Is there a way to create a py variable that is = to the max of columns created by casetovars (e.i., subcomand count in casetovars)?  Then set
spss.Submit("""
...
make apsid from apsid.1 to apsid.%r
""" % i


David's solution below.

<quote author="David Marso">
After the CASETOVARS.
COMPUTE @=1.
Then:
Change apsid.6 to @ in the remaining.
See other options for INDEX in FM.