BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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.
7 REPLIES 7
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.
Peter_C
Rhodochrosite | Level 12
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
deleted_user
Not applicable
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!
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.
Peter_C
Rhodochrosite | Level 12
since v8 of SAS we can read SASdata set by it's physical name. However, we cannot use the method to write
gkeeler
Calcite | Level 5

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

options noxsync noxwait;

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

Ksharp
Super 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

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
  • 7 replies
  • 4998 views
  • 0 likes
  • 5 in conversation