Date: Mon, 30 Mar 2009 16:42:15 -0400
Reply-To: D T <sasandstats@LIVE.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: D T <sasandstats@LIVE.COM>
Subject: Any ideas for smart way of including text responses into existing
data set -- re: recoded variables?
Content-Type: text/plain; charset="Windows-1252"
I am working with survey data (in a SAS data set), organized
by ID (1 to several rows per person, around 200 variables so far). We have
additional text fields that have not been incorporated into the data set yet;
this information is in excel sheets. These text fields contain free text
entries to a survey. They are being categorized into existing and new
categories. That means, some of the entries are considered to fall into a
category offered on the survey while others are considered to fall into a new
category. I am wondering if someone has thought of a smart way to get the information
into SAS. The “brute force” way would be to merge the data sets by ID, and then
either use a whole long list of if/then statements, or index/find statements,
etc., and pretty much hand recode every single possibility. But isn’t there a
smarter way? Could something be put into the excel cells that would make the
re-categorizing easier? Or any other ideas how to make this easier?
Right now, the excel sheets contain the categories as text,
while they will need to be turned into a 1 for an already existing variable or
a newly created variable (future/current variable name listed in othn1 and
Here is are somewhat simplistic examples of how my current SAS
data set looks like, and below that you’ll find an example of a data set containing
the free text entries and new categories:
in SAS data set:
ID inj dis hur pois oth
1 1 . .
1 . . 1 . .
1 1 . . . other1
2 . . . . .
2 . 1 . . .
3 . . . . other2
4 . . . 1 other3
4 1 . . . .
4 . . 1 . .
4 . 1 . . other1
5 . . . 1 .
5 . 1 1 . other4
ID oth othn1 othn2
1 other1 dis
3 other2 hur non
4 other3 dent
4 other1 dis
5 other4 non
What are your thoughts?
Internet Explorer 8 – Get your Hotmail Accelerated. Download free!