- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I have a dataset which contains multiple character responses. Below are four example of the same response as far as interpretation, but due to capitalization and punctuation, each response would have to be re-coded. There are multiple questions that have the same issue and I am trying to find ways to save time and also have code to make all the data uniform.
I wanted to clean-up the data prior to doing any re-coding by making all the responses uppercase and deleting any punctuation. Is there a SAS function that can do this?
Example of differences in format of responses, but interpretation is the same
I agree.
I Agree
I don't know
I Don't Know.
I appreciate any help you can give. Thank you.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi, this may get you started:
data have;
input var $20.;
new_var=upcase(compress(var,,'kda'));
put new_var=;
cards;
I agree.
I Agree
I don't know
I Don't Know.
;
Haikuo
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi, this may get you started:
data have;
input var $20.;
new_var=upcase(compress(var,,'kda'));
put new_var=;
cards;
I agree.
I Agree
I don't know
I Don't Know.
;
Haikuo
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Hai.kuo,
Thank you for your answer. It was very helpful. I was curious, does the 'kda' refer to the letters in the responses of the 'I agree' and 'I don't know'? Thanks again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
'kda' will let compress() to only Keep Digits(numbers) and Alphabet (letters), and get rid of anything else.
Haikuo
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Check out DataFlux. It is a SAS product specifically designed to improve data quality by doing things like standardizing responses.
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tom,
Is this a program that costs in addition to purchasing the SAS base program? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I'm afraid it is, and I believe it's fairly expensive. Really, it's only an option if your organization already has it, or alternatively, if your organization does enough data cleansing to make it worth licensing for the whole organization.
For your one requirement, it would be overkill.
Best,
Tom