|Date: ||Tue, 22 Feb 2011 08:13:26 -0800|
|Reply-To: ||"Pirritano, Matthew" <MPirritano@ochca.com>|
|Sender: ||"SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>|
|From: ||"Pirritano, Matthew" <MPirritano@ochca.com>|
|Subject: ||scratch variables in do-repeat loop|
I have a very large file (+4GB) and I don't want to add any unnecessary
variables to it. I am identifying claims with a diagnosis code
indicating that a mammography was done. There are eight diagnosis codes
so I need to check each one of them. I could create a new variable for
each diagnosis code saying whether it matched the ICD9 code for
mammography and then count the hits across these new variables. If there
was at least one hit I would say that there was a mammography. I'm
trying to do this with do repeat using scratch variables so that I don't
have to create 8 new variables. Let's say for the sake of argument that
"50000" is the code for mammography.
data list / test1 1-5 (A) test2 7-11 (A) test3 13-17 (A).
50000 64233 44444
88888 00321 23456
89989 50000 23242
dataset name test.
dataset activate test.
do repeat diagnosis = test1 to test3
/mammo_diag = #mammo_diag1 to #mammo_diag3.
if (ltrim(rtrim(diagnosis)) = "50000") mammo_diag = 1.
if (sum.1(#mammo_diag1 to #mammo_diag3)>0) mammo = 1.
"mammo" is the variable that says 1 for yes there was a mammography done
on that line. But what is happening is that when "50000" is identified
on line one of the data every subsequent line is getting a 1.
Can someone explain to me why this is not working? I'm sure I've done
Matthew Pirritano, Ph.D.
Research Analyst IV
Medical Services Initiative (MSI)
Orange County Health Care Agency