| Date: | Wed, 27 Feb 2002 14:41:43 -0600 |
| Reply-To: | pudding_man@lycos.com |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Puddin' Man <pudding_man@LYCOS.COM> |
| Organization: | Lycos Mail (http://mail.lycos.com:80) |
| Subject: | Version of Case Control Program |
| Content-Type: | text/plain; charset=us-ascii |
Subject: Version of Case Control Program
Here's a somewhat novel approach which *some* may
find interesting. <g>
Crude outline:
1.) Segregate male, female datasets as necessary.
2.) Make a "short pass" thru the female dataset.
Create a var (catcount) for the # of obs/category.
Create a var (rec) which points to the
last rec/category
in female dataset. Create an index on categories.
3.) To select the matched sample, get a male rec,
use the male category (indexed access) to get the
female metadata, use such to randomize the pointer
to the actual female data within the appropriate
categories.
Tested W2k 8.1:
*** test data: ***;
data male (drop = i) female;
do agecat = 20 to 55 by 5; *** <--- age category ***;
do inccat = 20 to 100 by 20;** <--- income category ***;
do i = 1 to 5; output female; end;
if ranuni (6) <.4 then output male;
end;
end;
run;
*** female metadata(sounds sexist, don't it?):-) ***;
data femalept (index = (ageinc = (agecat inccat) ) );
do catcount = 1 by 1 until (last.inccat);
set female (keep = agecat inccat);
by agecat inccat;
rec+1;
end;
run;
*** matched sample: ***;
data match nomatch;
set male;
set femalept key = ageinc;
If _iorc_ then output nomatch;
else do;
pt = rec - floor (catcount * ranuni(8));
set female point = pt;
output match;
end;
run;
This approach _might_ present some efficiencies if the
data were voluminous ...
Na Zdrowie,
Puddin'
******************************************************
*** Puddin' Man *** Pudding_Man@lycos.com ********
******************************************************;
-----Original Message-----
From: John Gerstle [mailto:JGerstle@SW.UA.EDU]
Sent: Tuesday, February 26, 2002 2:48 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Version of Case Control Program
SAS-Lers,
I'm looking for some sample Case Control code.
Presently, I have a dataset where I would like to match the 20
males with 20 females that match them along some parameters
out of a total of 200 females. In other words, I would like to run
some simple analyses based on gender, but only have 20 males
versus 200 females. And let's say, that the parameters I would like
to use are age (in five year increments) and income level (in $20K
increments).
So for every male, there is some subset of females that match
in terms of age level and income level, and I would like to randomly
select one of these females to 'pair' with the males. In this way,
the two genders will be matched on age and income.
I have been successful in manually creating matches (printing
out the data, highlighting matches, hard coding ids to pull, etc...).
But I would like to have something that would generalize over to a
larger dataset with many more levels (say, 100 males and 2000
females).
Does anyone have something that would do this? (I haven't
checked SCONSIG or the SAS site yet...thought I'd question the
List first in case others out there might need something similar.)
Thanks, John
John Gerstle, M.S.
Program Analyst, Sr.
Applied Gerontology Program
University of Alabama
---
******************************************************
*** Puddin' Man *** Pudding_Man@lycos.com ********
******************************************************;
2,000,000,000 Web Pages--you only need 1. Save time with My Lycos.
http://my.lycos.com
|