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?
Thanks,
Haritha
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.
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.
Then thats how it was imported.
Why are you expecting different? What do you have and what do you want?
Post a snapshot of your file and your proc contents and what you want.
Thanks for your reply, I got it now. May the file has not defined with different labels.
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.
Thank you . it really helped me to understand
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.