Help using Base SAS procedures

how to import XLS file when variable names in first two rows

Reply
Frequent Contributor
Posts: 128

how to import XLS file when variable names in first two rows

I try to use button file->import data to import data from a XLS file.

But the problem is, variable names are in the first two rows. Is there any option I can choose the first tow rows as variable names?

for example:

For example:
Variable A Variable B
v1 v2 v3 v4 v5 v6 v7 v8

I try to import all these data as:
VAv1 VAv2 VAv3 VAv4....




Thanks!!
N/A
Posts: 0

Re: how to import XLS file when variable names in first two rows

I think you are going to have to change the variable names in Excel before importing them to SAS. You can do it very easily using the formulas of Excel. Use the formula below in cell A1 to create a new variables name:

="VA" & [Sheet1!]A2

This will create a new variable name in the cell A1 with the name: Vav1

To make it even easier, replace all "Variable A" with "VA" and Variable B" with VB" before using the above the formula. The use the below solution in cell A1:

= [Sheet1!]A1 & [Sheet1!]A2

Copy and paste this formula across the row, and there you go, you have your new variable names... Then copy you entire data to this new sheet. Import this new sheet...

Hope this helps...
Frequent Contributor
Posts: 128

Re: how to import XLS file when variable names in first two rows

owo!! Great!!

That is what I need! Thanks!!!
Ask a Question
Discussion stats
  • 2 replies
  • 145 views
  • 0 likes
  • 2 in conversation