I am working with a dataset that contains information about individuals and their relationships with other individuals. Each observation in the dataset includes a series of binary variables, with each variable equal to 1 if the individual knows another individual (including themselves). There are a total of n individuals and therefore n variables.
I have an Excel spreadsheet that I would like to import into Stata, but the variable names are too long for Stata to recognize them as variables. I only need a portion of the variable name, specifically the id number of the individual that the variable refers to.
Is there a way to import the first line of the Excel file into Stata as just the id number (e.g. N45 if the name of the variable in Excel is "looooooooongname (N45) loooongname")? If not, is there a workaround to achieve this? I am new to data cleaning and open to any suggestions. Note that I am not sure if I am allowed to directly edit the Excel file, so that is not an option.
I am new to data cleaning, so any advice would help! I wish I could give a -dataex- example, but I'm not even at the step where I have a Stata dataset at my disposal... So apologies for this

0 Response to Importing Excel variables into Stata with shortened names
Post a Comment