- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 07-17-2009 12:14 PM
(6708 views)
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.
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.
7 REPLIES 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
http://support.sas.com/kb/15/989.html
Scott Barry
SBBWorks, Inc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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!
Also, it doesn't appear possible to create a SAS data set in which the name includes a hyphen. Is this correct?
Thanks again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
Scott Barry
SBBWorks, Inc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
since v8 of SAS we can read SASdata set by it's physical name. However, we cannot use the method to write
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
*** This renames the same file to CamelCase: ***;
options noxsync noxwait;
%sysexec rename "%sysfunc(pathname(work))\badname.sas7bdat" "BadName.sas7bdat";
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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