BookmarkSubscribeRSS Feed
Steve1964
Obsidian | Level 7

Can I rename a variable in a SAS data set without input/output actions in data step, since I don't change the data stored in the set actually?

4 REPLIES 4
SaraBoltman1
Fluorite | Level 6

Yes, you could use proc sql instead:

 

proc sql; create table TEST as select

old_name as new name,

other_stuff,

more_other_stuff

from TEST;

quit;

 

Or proc datasets.

 

PaigeMiller
Diamond | Level 26

@SaraBoltman1 wrote:

Yes, you could use proc sql instead:

 

proc sql; create table TEST as select

old_name as new name,

other_stuff,

more_other_stuff

from TEST;

quit;

 


Doesn't this require the processing of every observation in the data step?

 

Or proc datasets.

 

I'm 100% sure this does not require processing of every observation in the data step. It doesn't even have to process one observation.

--
Paige Miller
Ksharp
Super User
data have;
 set sashelp.class;
run;
proc datasets library=work nolist nodetails;
modify have;
rename name=xxxxxx;
quit;
andreas_lds
Jade | Level 19
@Steve1964 No, you cant. As suggested by @Ksharp, uwing proc datasets is the most efficient way to solve the issue.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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