Help using Base SAS procedures

Dataset Name UpperCase

Reply
N/A
Posts: 0

Dataset Name UpperCase

I am trying to figure out how to create a data set that has each letter in the file name capitalized. It seems as though any code that I create:

data xample.ABC123_04JUL1776_ZZ99;

the name of the file is abc123_04jul1776_zz99.sas7bdat - all lower case. Is there a way to create this kind of file with upper case letters instead of having to manually change them after the process is run?


Thanks in advance for any/all help.
Super Contributor
Super Contributor
Posts: 3,174

Re: Dataset Name UpperCase

Posted in reply to deleted_user
For the SAS system, this behavior is by-design on some platforms with no wiggle-room to change it. As I did, you will find this type of information out on the SAS support http://support.sas.com/ website -- here is the result of a search I performed:

http://support.sas.com/kb/15/989.html


Scott Barry
SBBWorks, Inc.
Valued Guide
Posts: 2,177

Re: Dataset Name UpperCase

Posted in reply to deleted_user
DCDX

although it is possible to have a data statement (of a data step) write the dataset in a physical name that is entirely of your choice(including uppercase letters), you then are limited in the SAS facilities that can recognise and read it.
Why would you want to give yourself this trouble?

PeterC
N/A
Posts: 0

Re: Dataset Name UpperCase

Scott, Peter, thank you both for the input. While I certainly understand that limitations are imposed by capitalizing the data set name, the specific naming convention is requested by the person for whom the SAS data set is being created for. Thus, I was just looking to see if there was a way, in cases that capital letters were needed, to automate this task within the code.


Also, it doesn't appear possible to create a SAS data set in which the name includes a hyphen. Is this correct?


Thanks again!
Super Contributor
Super Contributor
Posts: 3,174

Re: Dataset Name UpperCase

Posted in reply to deleted_user
Correct. Considering the hyphen character, that would be a file-system limitation likely, not SAS. An underscore works though - may or may not be a suitable alternative. I expect SAS Institute wanted to set a standard, one that would work across most, if not all, the OS platforms, excluding the IBM mainframe which uses all uppercase for SAS data library and sequential (SAS dataset) file naming.

Scott Barry
SBBWorks, Inc.
Valued Guide
Posts: 2,177

Re: Dataset Name UpperCase

Posted in reply to deleted_user
since v8 of SAS we can read SASdata set by it's physical name. However, we cannot use the method to write
Occasional Contributor
Posts: 9

Re: Dataset Name UpperCase

Posted in reply to deleted_user

*** This renames the same file to CamelCase: ***;

options noxsync noxwait;

%sysexec rename "%sysfunc(pathname(work))\badname.sas7bdat" "BadName.sas7bdat";

Super User
Posts: 10,046

Re: Dataset Name UpperCase

Posted in reply to deleted_user

I like gkeeler 's idea. You can make a bat file to rename these tables.Assuming all your tables are under c:\

filename x pipe 'dir c:\*.sas7bdat /b';
data _null_;
infile x truncover;
file 'c:\rename.bat';
length row $ 200;
input fname : $50.;
row='rename '||strip(fname)||' '||upcase(strip(fname));
put row;
run;

x 'cd c:\';
x 'c:\rename.bat';



Ksharp

Ask a Question
Discussion stats
  • 7 replies
  • 1409 views
  • 0 likes
  • 5 in conversation