Keep variables

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

Keep variables

Suh-Ing Amy Hsieh
Dear listers:

I am using id and readmission date to select
cases for keeping desired variables in another file. Yet, it did not work
out for me. There are 203 cases with 30-day readmission.  Also, the
number of readmission for the first transplant ranges from 1 or 5.
Is there any simple way to create syntax for this procedure? Please help
and thank you very much.
Amy



**Step 1: Select readmission cases for keeping desired variables**.
SORT CASES BY id in_date.
IF (id =
'c9ac6d8007b811bd97dfe9342eb1b8f2') AND (in_date = '20040202') KEEP =
id hosp_id in_date out_date e_bedd s_bedd tran_cd icd9cd to icd9cd4
icdopcd to icdopcd4 med_am.

Error # 4309 in column
15.  Text: hosp_id
Invalid combination of data types in an
assignment.  Character strings may only be assigned to string
variables.  Numeric and logical quantities may only be assigned to
numeric variables.  Consider using the STRING or NUMBER function.
This command not executed.

IF (id =
'b42ff15dfaabaf087a4b884fcd848d8b' AND in_date = '20050511') KEEP = id
hosp_id in_date out_date e_bedd s_bedd tran_cd icd9cd to icd9cd4 icdopcd
to icdopcd4 med_am.

IF (id = 'd05578eae5bedbc52dcee0da93628f64'
AND in_date = '20030215' OR in_date = '20030228') KEEP = id hosp_id
in_date out_date e_bedd s_bedd tran_cd icd9cd to icd9cd4 icdopcd to
icdopcd4 med_am.

IF (id = '50185beed11cde2a5b9a51ef659e2ed5'
AND in_date = '20010920' OR in_date = '20010923' OR in_date = '20011001')
KEEP = id hosp_id in_date out_date e_bedd s_bedd tran_cd icd9cd to icd9cd4
icdopcd to icdopcd4 med_am.

IF (id =
'17003d08db8082ac5fd9d1c32d8649b9' AND in_date = '20020126' OR in_date =
'20020129' OR in_date = '20020204' OR in_date = '20020208' OR in_date =
'20020218') KEEP = id hosp_id in_date out_date e_bedd s_bedd tran_cd
icd9cd to icd9cd4 icdopcd to icdopcd4 med_am.
EXECUTE.

**Step 2: Save resulting dataset with matched records**.
SAVE OUTFILE = 'F:\NHIRD_hsct5\dd2001_2006 30-day readmission'.
  /COMPRESSED.

=====================
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: Keep variables

Frans Marcelissen-2
It is unclear to me what you are trying to do.
"IF ... KEEP = ..." assigns a value to the variable "KEEP", and that is
surely not what you want. If what you want is saving subsets of cases to
different files, than select if and save does the job. Could you describe in
more detail what you need?


-------------------------------------------
Frans Marcelissen
email [hidden email]

-----Oorspronkelijk bericht-----
Van: SPSSX(r) Discussion [mailto:[hidden email]] Namens SUH-ING
(AMY) HSIEH
Verzonden: vrijdag 9 januari 2009 7:03
Aan: [hidden email]
Onderwerp: Keep variables

Dear listers:

I am using id and readmission date to select
cases for keeping desired variables in another file. Yet, it did not work
out for me. There are 203 cases with 30-day readmission.  Also, the
number of readmission for the first transplant ranges from 1 or 5.
Is there any simple way to create syntax for this procedure? Please help
and thank you very much.
Amy



**Step 1: Select readmission cases for keeping desired variables**.
SORT CASES BY id in_date.
IF (id =
'c9ac6d8007b811bd97dfe9342eb1b8f2') AND (in_date = '20040202') KEEP =
id hosp_id in_date out_date e_bedd s_bedd tran_cd icd9cd to icd9cd4
icdopcd to icdopcd4 med_am.

Error # 4309 in column
15.  Text: hosp_id
Invalid combination of data types in an
assignment.  Character strings may only be assigned to string
variables.  Numeric and logical quantities may only be assigned to
numeric variables.  Consider using the STRING or NUMBER function.
This command not executed.

IF (id =
'b42ff15dfaabaf087a4b884fcd848d8b' AND in_date = '20050511') KEEP = id
hosp_id in_date out_date e_bedd s_bedd tran_cd icd9cd to icd9cd4 icdopcd
to icdopcd4 med_am.

IF (id = 'd05578eae5bedbc52dcee0da93628f64'
AND in_date = '20030215' OR in_date = '20030228') KEEP = id hosp_id
in_date out_date e_bedd s_bedd tran_cd icd9cd to icd9cd4 icdopcd to
icdopcd4 med_am.

IF (id = '50185beed11cde2a5b9a51ef659e2ed5'
AND in_date = '20010920' OR in_date = '20010923' OR in_date = '20011001')
KEEP = id hosp_id in_date out_date e_bedd s_bedd tran_cd icd9cd to icd9cd4
icdopcd to icdopcd4 med_am.

IF (id =
'17003d08db8082ac5fd9d1c32d8649b9' AND in_date = '20020126' OR in_date =
'20020129' OR in_date = '20020204' OR in_date = '20020208' OR in_date =
'20020218') KEEP = id hosp_id in_date out_date e_bedd s_bedd tran_cd
icd9cd to icd9cd4 icdopcd to icdopcd4 med_am.
EXECUTE.

**Step 2: Save resulting dataset with matched records**.
SAVE OUTFILE = 'F:\NHIRD_hsct5\dd2001_2006 30-day readmission'.
  /COMPRESSED.

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