BookmarkSubscribeRSS Feed
haritha
Calcite | Level 5

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

6 REPLIES 6
Reeza
Super User

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.

haritha
Calcite | Level 5

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.

 

 

Reeza
Super User

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. 

haritha
Calcite | Level 5

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

ballardw
Super User

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.

haritha
Calcite | Level 5

Thank you . it really helped me to understand

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1172 views
  • 0 likes
  • 3 in conversation