Syntax help needed to rearrange database

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

Syntax help needed to rearrange database

leah rubin
Dear Listserv,

I have a data file:

ID  Visit   antidepressant 
101  1            name     
101  1            name
101  2            name
101  4            name
102  1            name
102  1            name
.
.
.
.

Could someone please help me create syntax so that each ID will only have 1 line of data for a visit.
For example, I only want ID 101 to have one line for Visit 1, 2, and 4. At this point I do
not care about the name of the drug. I just want to know whether a subject was on a antidepressant
at each of their visits.

Many thanks for your help in advance,
leah
Reply | Threaded
Open this post in threaded view
|

Re: Syntax help needed to rearrange database

David Marso
Administrator
See AGGREGATE command!
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: Syntax help needed to rearrange database

Marks, Jim
In reply to this post by leah rubin
Dataset activate yourdata.
Dataset declare pervisit.

Aggregate outfile = pervisit
/break = Id visit
/antidepressant = First (antidepressant)
.
Dataset activate pervisit window = front.


Jim Marks


From: SPSSX(r) Discussion <[hidden email]>
To: [hidden email] <[hidden email]>
Sent: Thu Feb 02 11:16:54 2012
Subject: Syntax help needed to rearrange database

Dear Listserv,

I have a data file:

ID  Visit   antidepressant 
101  1            name     
101  1            name
101  2            name
101  4            name
102  1            name
102  1            name
.
.
.
.

Could someone please help me create syntax so that each ID will only have 1 line of data for a visit.
For example, I only want ID 101 to have one line for Visit 1, 2, and 4. At this point I do
not care about the name of the drug. I just want to know whether a subject was on a antidepressant
at each of their visits.

Many thanks for your help in advance,
leah
Reply | Threaded
Open this post in threaded view
|

Re: Syntax help needed to rearrange database

Arthur Kramer
In reply to this post by leah rubin

You can use DATA>RESTRUCTURE>SELECTED CASES TO VARIABLES and on the next screen index on ID.

 

Arthur Kramer

 

"Believe half of what you see and none of what you hear."

 

N. Whitfield

B. Strong

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of leah rubin
Sent: Thursday, February 02, 2012 12:17 PM
To: [hidden email]
Subject: Syntax help needed to rearrange database

 

Dear Listserv,

I have a data file:

ID  Visit   antidepressant 
101  1            name     
101  1            name
101  2            name
101  4            name
102  1            name
102  1            name
.
.
.
.

Could someone please help me create syntax so that each ID will only have 1 line of data for a visit.
For example, I only want ID 101 to have one line for Visit 1, 2, and 4. At this point I do
not care about the name of the drug. I just want to know whether a subject was on a antidepressant
at each of their visits.

Many thanks for your help in advance,
leah