Mapping Files
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi there,
I have a mapping file and several other files. I want to change the names of variables based on the mapping file. In the 2016_original_data, we have the original variables. Now, I want to rename these variables according to the mapping file.
The mapping file contains five columns: dataset_name, variable_old, value_old, variable_new, and value_new. If variable_new in the mapping file is null, then we want to remove that variable from the 2016_original_data file.
If variable_new is not null, then we want to replace variable_old in the file with variable_new from the mapping file. If the value in sex (variable_old) equals 0, then replace it with 1; if the value in sex (variable_old) equals 1, then replace it with 0.
Could you please let me know how to achieve this?
Thanks,
Simon
Solved! Go to Solution.
- Labels:
- Data Investigation
- Datasets
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Simon1187 you need dynamic rename, I've done something and attached it below.
I was a bit confused when you say "If the value in sex (variable_old) equals 0, then replace it with 1; if the value in sex (variable_old) equals 1, then replace it with 0."
so ignored it
hope it helps
