[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Changing 2 columns of repetitive ASCII data into many columnssorted by variable
I have recently purchased a dataset which contains food codes in 7-bit
ASCII format from the UK Food Standards Agency. However, they are not
yet in a format that I can use for any meaningful analysis and their
technicial support is unable to assist.
The data as they stand fall into 2 columns: varname|value. NUMB is the
food code - i.e. the variable that I want to sort the data by.
I would like to have all of the other variables along the top as
separate columns, so that I end up with individual food codes and their
nutrient values - see below. With these data I can then do dietary
This format goes on for several thousand different food codes, over and
over. Codes are separated by the line ***
How it is now:
NAME Apples, cooking, raw, peeled
NAME Apples, cooking, weighed with skin and core
What I would like to have:
Code | Description | Group | Water | Fat | CHO | Protein | Sodium |
14001 | Apples | Fruit | 26 | 5.1 | 4.2 | 3.6 | 0.1 | 0.04
14002 | Oranges | Fruit | etc
Does anyone have any suggestions as to how to arrange the data into
something I can use?
* For searches and help try: