BookmarkSubscribeRSS Feed
thanikondharish
Fluorite | Level 6

a1

a2

a3

a4

a5

name

age

sex

country

race

101

22

f

india

black

102

23

m

india

white

103

24

f

usa

black

 

take first record create as variable names like see below

name

age

sex

country

race

101

22

f

india

black

102

23

m

india

white

103

24

f

usa

black

 

 

5 REPLIES 5
thanikondharish
Fluorite | Level 6
i did by using import but how to do without using proc import
andreas_lds
Jade | Level 19

There is no information about "race" in the first table ...

 

The name alone is not sufficient to create a variable, type and length are required, too. That information could be extracted for the variables a1-a4 from sashelp.vcolumn, so you don't need to provide it, if having all variables as character-vars satisfies conditions.

 

Is it really necessary to create new variables? Would renaming a1-a4 be ok?

 

Can you post the table as dataset using datalines statement, so that we have something to work with?

 

Ksharp
Super User

proc import............;

getnames=yes;

run;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1525 views
  • 6 likes
  • 4 in conversation