LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 1999, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 14 Dec 1999 00:13:02 GMT
Reply-To:   Kyle Dane <kyledane@MY-DEJA.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Kyle Dane <kyledane@MY-DEJA.COM>
Organization:   Deja.com - Before you buy.
Subject:   Deceptive problem with 'retain'

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; 5 demog2=demog2; 6 data; 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).

-- Kyle Dane Programmer/Analyst - UCSF Division of Geriatrics kdane@medicine.ucsf.edu - 415-514-0714

Sent via Deja.com http://www.deja.com/ Before you buy.


Back to: Top of message | Previous page | Main SAS-L page