05-09-2016 07:13 PM
How to find labels of a dataset while importing ".xlsx" file using datafile statement?
I tried Proc Contents using VARNUM, I'm getting the same variable names as label names.
Is there any other procedure to find actual labels?
05-09-2016 07:21 PM
If proc contents is showing the same values for name and label, that's how it was imported.
I believe the default is to import labels. Can you describe a bit more about what you're trying to do and what's not working as expected.
05-09-2016 07:27 PM
I'm importing a .xlsx file, which has some sample data, i want to find the labels for the variables.
But when i use Proc contents using varnum also, I'm getting labels as same as variables.
05-10-2016 10:43 AM
Excel does not have a concept of labels, it has the value of a cell and that is about it.
Depending on how you read data from Excel you may get the colum header text transformed to a valid SAS variable name.
For example if the Excel column header is "Measure taken @ date 01/23/2015"
Then SAS replaces all characters that are not letters, numbers or _ with an _ to create a varaible name.
If you want a LABEL that is more useful then you can use something like Proc Datasets to create a Label and/or rename the variables to be more amenable to programming.
I know I'm not going to type measure_taken___date_01_23_2015 very often in my code.