BookmarkSubscribeRSS Feed
CMilena
Calcite | Level 5
Hi. I have a very easy problem that i can't seem to google myself out of. I've searched the forums, but without luck.

I want renames more sas dataset
ex: current dataset names : x_2011, x_2010, x_2009, x_2008 ...
new_manes: p_2011, p_2010, p_2009, p_2008 ...

I can use
PROC DATASETS LIBRARY=xxx;
CHANGE db_old=db_new;

QUIT;RUN;

but I won't repeat db's name.

How can I do?

Thanks in advance ...
2 REPLIES 2
data_null__
Jade | Level 19
I believe the only way is to "gen the code".

[pre]
188 data x_2011 x_2010 x_2009 x_2008;
189 stop;
190 run;

NOTE: The data set WORK.X_2011 has 0 observations and 0 variables.
NOTE: The data set WORK.X_2010 has 0 observations and 0 variables.
NOTE: The data set WORK.X_2009 has 0 observations and 0 variables.
NOTE: The data set WORK.X_2008 has 0 observations and 0 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds


191 proc sql noprint;
192 select catx('=',memname,cats('s',substr(memname,2))) into :change separated by ' '
193 from dictionary.members
194 where libname eq 'WORK' and memname eqT 'X_';
195 quit;
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds


196 run;
197 %put NOTE: CHANGE=&change;
NOTE: CHANGE=X_2008=s_2008 X_2009=s_2009 X_2010=s_2010 X_2011=s_2011
198 proc datasets;
Directory

Libref WORK
Engine V9
Physical Name (system-specific file/path name)


Member
# Name Type

1 X_2008 DATA
2 X_2009 DATA
3 X_2010 DATA
4 X_2011 DATA
199 change &change;
200 run;

NOTE: Changing the name WORK.X_2008 to WORK.S_2008 (memtype=DATA).
NOTE: Changing the name WORK.X_2009 to WORK.S_2009 (memtype=DATA).
NOTE: Changing the name WORK.X_2010 to WORK.S_2010 (memtype=DATA).
NOTE: Changing the name WORK.X_2011 to WORK.S_2011 (memtype=DATA).
201 quit;

NOTE: PROCEDURE DATASETS used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
[/pre]
CMilena
Calcite | Level 5
I never can find this solution
Thank you very much!

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
  • 2 replies
  • 962 views
  • 0 likes
  • 2 in conversation