Help using Base SAS procedures

labels

Reply
Occasional Contributor
Posts: 11

labels

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

Super User
Posts: 17,784

Re: labels

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.

Occasional Contributor
Posts: 11

Re: labels

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.

 

 

Super User
Posts: 17,784

Re: labels

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. 

Occasional Contributor
Posts: 11

Re: labels

Thanks for your reply, I got it now. May the file has not defined with different labels.

Super User
Posts: 10,483

Re: 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.

Occasional Contributor
Posts: 11

Re: labels

Thank you . it really helped me to understand

Ask a Question
Discussion stats
  • 6 replies
  • 340 views
  • 0 likes
  • 3 in conversation