07-31-2014 01:16 PM
I have a SAS library with more than 50 memnames, some memnames are in lower case, some upper and some mix, I want to convert all of them into upcase without loosing any information.
07-31-2014 06:39 PM
Which OS are you using? SAS doesn't care much about case, so I'm assuming this has something that is OS dependent. In which case the methods are likely to be different.
08-01-2014 07:16 AM
There is a simple solution involving proc transpose if all your variables are numeric (or all character).
This more general solution works for me in the University edition, however you may experience a problem where the name is already uppercase. (If the %put &myvars ; statement results in a string entirely composed of uppercase, you are out of luck)
data have ;
CamelCase = 123 ;
proc print ;
proc sql noprint ;
Select catx ("=",Name,upcase(Name))
separated by " "
where libname = 'WORK'
and memname = 'HAVE'
and name <> upcase(name)
%Put &myvars ;
Proc datasets library = work noprint ;
modify have ;
rename &myvars ;
proc print ;
08-01-2014 09:31 AM
1) Thanks for replying. I am using SAS 9.3(64bit) Windows
2) I want memname upcase, not the varibale names, library has almost 150 datasets, some datasets names are lower,some upper and some mix, my boss asked to convert all memname to uppcase without rewriting them.
Once again thanks for any help.
08-01-2014 10:22 AM
You could also call execute or call system the rename statement save on the writing the batch file.
set sashelp.vtable (where=(libname="Your_libname"));
call system('rename '||strip(memname)||' '||strip(memname));
On a different note, you may want to be careful. Case doesn't generally matter on Win, xyz.zyx = xyz.XYZ. However if you have other software installed which is using this information you may find that it does matter. Early versions of SVN for instance were prone to errors when two records of the same file, with different cases were present, as both want to extract to the same file on Win (but it would work fine on Unix).
08-01-2014 09:54 AM
A simple way is to make a BAT file and execute a bunch of OS command RENAME .
Assuming the library is c:\temp .
options noxwait ; filename bat 'd:\rename.bat'; filename x pipe 'dir c:\temp\*.* /b '; data _null_; file bat; infile x truncover; input fname $50.; if _n_ eq 1 then put 'cd c:\temp'; x=catx(' ','rename',fname,upcase(fname)); put x; run; x 'd:\rename.bat' ;
08-03-2014 05:17 PM
Just upcase the memname only when you need to
I don't know in what context you want these memnames as uppercase.
if it is in a proc report or print just use the $UPCASE. format.
If it is for a query in proc sql just use
where upcase(memname) = "%upcase(¶meter)"
or something like this join
select U.*, S.nobs, S.modate, S.libname
From yourdata U join sashelp.vtable S
on upcase(S.memname) = upcase(U.memname)
08-07-2014 04:30 PM
Hi Thanks for help:
Actually in SAS explorer window when i click on a certain library, some table names appear in uppere case ,some lower case, some mix because at the time when someone was writing those table names on the server he/she saved that way. Now I want to see all those table names in upper case, exclusively in explorer window not in any report or in any other query.
eg(In SAS explorer windows)
content of mylib
I want to see all these in upper case instead lower or mix . Make sure I do not want to rewrite a table name because library has more than 160 tables and data stays on server
08-07-2014 04:58 PM
I still think this is an Operating System issue and you haven't said which OS those files reside on. You may be able to use some of the above information to write a script for your OS to RENAME the files. Last time I checked practically every operating system has some form of RENAME that doesn't change the contents of the file.
08-07-2014 05:34 PM
If your MYLIB is assigned through a SAS/ACCESS library engine, you have to work witb what is there as many of these external systems have table names wbich are case-sensitive ( including microsoft excel but not Oracle iirc). In that case-sensitive world there could be two different tables which would appear to have duplicate names when presented in uppercase.
If you create your own list you would be "in control" of how the names appear. I don't believe you can modify how the built-in listers present.