I'm trying to distribute demographic information across several records
with a retain statement. I'll give a data example:
obs id time race gender
1 1 1 W M
2 1 2 . .
3 1 3 . .
I want race and gender to appear for id #1 on all three of his records
(along with 6000 other people). My method was:
1 proc sort; by id time;
2 data; by id;
3 retain demog2;
4 if first.id then demog2=race;
7 drop race;
8 rename demog2=race;
This has always seemed strange to me - that 'demog2=demog2' line. But
it worked, so I didn't question it. Unfortunately, when I ran the
gender analysis this way (substituting demog2=gender into line 4), it
didn't work. So I'm wondering what the proper syntax is. I can't seem
to find a passage in the manual that deals with this specifically (which
baffles me, but that's another post).
Programmer/Analyst - UCSF Division of Geriatrics
firstname.lastname@example.org - 415-514-0714
Sent via Deja.com http://www.deja.com/
Before you buy.