BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Feddy
Obsidian | Level 7

SAS Log window.jpg
Feddy
Obsidian | Level 7

yes, You are correct.how to change my Var name   


Capture.JPG
Shmuel
Garnet | Level 18

You probably got variables name as var1-var8 using proc import,

because your data does not include first row with colomn labels.

 

You can rename variables either in the out clause of proc import, as:

        out=contest(rename=(var1=FName var2=LName var3=age ...etc. ...))

or, alternativly, use as second step:

proc datasets lib=<libarary holding the dataset>;

        modify contest;

        rename var1=FName var2=LName var3=age ...etc ...;

run; quit;

Feddy
Obsidian | Level 7

sir!!! thank you so much i got the output.Just one thing need to clear, shall i specify my own length for the each variables?? if possible how can i make please give me as solution.


Capture.jpg
Shmuel
Garnet | Level 18

Renaming the variable name does not change its length. 
You may select specific character variables, only if you find it preferable, and redefine their length.

It is not a must.

 

Reeza
Super User

You can't change the length in a PROC DATASETS only rename. You can use a data step to do both.

 

If you've already assigned a length and are just renaming the variables a new length won't change the variables value. 

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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
  • 20 replies
  • 4182 views
  • 3 likes
  • 4 in conversation