Re: Creating a new file for a subset of cases/IDs

Posted by MLIves on
URL: http://spssx-discussion.165.s1.nabble.com/Creating-a-new-file-for-a-subset-of-cases-IDs-tp5740376p5740381.html

Hi Oliver,

Sounds like you should look at the /in= or the /table= subcommands for Match files (merge files--add variables).
If you include /in=inDataset2 after naming dataset2, the resulting file will be 0 for the records you don't want and 1 for those in Dataset2 that you do want. So in the resulting file, you would need one more step:
        Select if inDataset2.

/Table could be used to find and keep only those in the lookup table (Dataset2).

Melissa
-----Original Message-----
From: SPSSX(r) Discussion <[hidden email]> On Behalf Of Oliver
Sent: Monday, April 5, 2021 2:10 PM
To: [hidden email]
Subject: [SPSSX-L] Creating a new file for a subset of cases/IDs

EXTERNAL EMAIL: This email originated from outside of the organization. Do not click any links or open any attachments unless you trust the sender and know the content is safe.

Hi everyone,

I have a dataset (Dataset 1) with 3000 different cases (i.e., IDs) and let's say, two variables (y1, y2). I would like to create a new dataset (Dataset
2) that includes data for y1 and y2, but only for a subset of IDs from Dataset 1.  I've created Dataset 2 with only the subset (i.e., n = 1500) of IDs of interest and then tried to use the "Merge file-->Add variables", but the newly created dataset (i.e., Dataset 2) always generates 3000 cases, not just the 1500 that I need.

Any assistance would be greatly appreciated.
Thanks in advance.
O.



--
Sent from: https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fspssx-discussion.1045642.n5.nabble.com%2F&amp;data=04%7C01%7CMelissa.Ives%40ct.gov%7C0c62d938816b4a15f6f908d8f85e02ff%7C118b7cfaa3dd48b9b02631ff69bb738b%7C0%7C0%7C637532429994861101%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=QFcmI1wM9kq3LTpQTkA1e16lrjzcV%2F9%2F7AYrxjEevmo%3D&amp;reserved=0

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

________________________________

This correspondence contains proprietary information some or all of which may be legally privileged; it is for the intended recipient only. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this correspondence and completely dispose of the correspondence immediately. Please notify the sender if you have received this email in error. NOTE: Messages to or from the State of Connecticut domain may be subject to the Freedom of Information statutes and regulations.

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