I am working with a Stata formatted dataset from an organization that sent me the value labels in SAS format. I have Stata data in one file and then a separate Excel spreadsheet that has four columns: value label, value name, data type (not useful for Stata) and current data field value. The variable names that use those value labels are not included in that spreadsheet.
I am trying to create a .do file that will generate the value labels I want from the Excel sheet, so that I can label the variables with the appropriate values.
For each label in column 2, label define based on columns 4 and 1. Thus, for the table example below:
label define ABO 1 "O" 2 "A" 3 "B" 4 "AB"
label define ABOMAT 1 "Identical" 2 "Compatible" 3 "Incompatible"
And then assign them to the .dta file?
I appreciate any advice!
Thanks,
Sarah
I am trying to create a .do file that will generate the value labels I want from the Excel sheet, so that I can label the variables with the appropriate values.
For each label in column 2, label define based on columns 4 and 1. Thus, for the table example below:
label define ABO 1 "O" 2 "A" 3 "B" 4 "AB"
label define ABOMAT 1 "Identical" 2 "Compatible" 3 "Incompatible"
And then assign them to the .dta file?
I appreciate any advice!
Thanks,
Sarah
| Data Field Formatted Value | SAS ANALYSIS FORMAT | DATA TYPE | Data Field Value |
| O | ABO | C | 1 |
| A | ABO | C | 2 |
| B | ABO | C | 3 |
| AB | ABO | C | 4 |
| Identical | ABOMAT | C | 1 |
| Compatible | ABOMAT | C | 2 |
| Incompatible | ABOMAT | C | 3 |

Comment