A question about update

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

A question about update

Jamison, Cheryl S
Hello Everyone-- I have used Update successfully in the past, but only
when the file with the updating variables includes a subset (or all) of
the cases in the file to be updated.  I now want to update a file that
only includes about 15% of the cases in the  active file  (that is, each
file includes cases that the other does not).  When I try to run update,
it adds all of the cases from the active file and thus the updated file
now has a large number of cases, most of which I don't want.  Is there
any way to limit update to the caseids that are in both files?  Perhaps
I should explain that the data are from a telephone survey - for the
second round, we called some cases that were also called in the first
round - so we didn't need to ask them the basic demographics.
   Thanks so much-
       Cher

Cher Jamison, Associate Scientist
Study Director of the Sociological Research Practicum
Karl F. Schuessler Institute of Social Research
Indiana University
1022 E. 3rd Street
Bloomington, IN 47405
(812) 855-8985
Reply | Threaded
Open this post in threaded view
|

Re: A question about update

Maguin, Eugene
Cheryl,

Perhaps somebody else will have a better idea or I may not understand your
problem but I don't think there is a single step procedure for this.
Certainly, no command that I know of to specify on the update command. I
guess the way I might do this would be to add a variable to the master file
(the file to be updated) and assign it a value, do the update operation, and
then select cases from the resulting file such that the new variable has a
non sysmis value.

Gene Maguin
Reply | Threaded
Open this post in threaded view
|

Re: A question about update

Florio Arguillas
In reply to this post by Jamison, Cheryl S
Hi Cheryl,

Try using the IN subcommand of the UPDATE command.  Also, the Command
Syntax Reference documentation also provides an explanation about the
"behavior" or operation of the UPDATE command.

Here's a sample code.  See if this generates the data that you want.

UPDATE FILE = '<masterfile>'/IN=XXX
                 /FILE = '<transactionfile>'/IN=YYY
                 /BY HH Item.

SELECT IF XXX=1 AND YYY = 1.
*SELECT IF XXX AND YYY.

save outfile 'thedatathatineed'.


Masterfile is the file to be udpated.

Transaction file is the file that contains the updated values.

The IN subcommand creates a variable XXX whose values are 1 and
0.  If the master file contributed a record to the new active dataset
created by the UPDATE command, XXX will have a value of 1.  If not,
it would have a value of zero.  If the transaction file contributed a
record to the new active dataset created by the UPDATE commahnd, YYY
will have a value of 1.  If not, it would have a value of zero

The two SELECT IF commands are one and the same in terms of
operation. So you can choose either one.

HTH,

Florio




At 10:04 AM 9/8/2007, Jamison, Cheryl S wrote:

>Hello Everyone-- I have used Update successfully in the past, but only
>when the file with the updating variables includes a subset (or all) of
>the cases in the file to be updated.  I now want to update a file that
>only includes about 15% of the cases in the  active file  (that is, each
>file includes cases that the other does not).  When I try to run update,
>it adds all of the cases from the active file and thus the updated file
>now has a large number of cases, most of which I don't want.  Is there
>any way to limit update to the caseids that are in both files?  Perhaps
>I should explain that the data are from a telephone survey - for the
>second round, we called some cases that were also called in the first
>round - so we didn't need to ask them the basic demographics.
>    Thanks so much-
>        Cher
>
>Cher Jamison, Associate Scientist
>Study Director of the Sociological Research Practicum
>Karl F. Schuessler Institute of Social Research
>Indiana University
>1022 E. 3rd Street
>Bloomington, IN 47405
>(812) 855-8985