DATA Step, Macro, Functions and more

Can Libname statement read the datasets which are named in capital letters/upcase on Unix?

Reply
Occasional Contributor
Posts: 7

Can Libname statement read the datasets which are named in capital letters/upcase on Unix?

Hi,

    I am working on Unix environment and have been trying to read copy the data-sets from a particular library to work. But while executing the below statement I am able to copy the data-sets which are in lower case. And the data-sets in upper case are not moved to work library.

Proc copy in=mylib out=work;run;

Is there any option to read such data-sets?

Frequent Contributor
Posts: 129

Re: Can Libname statement read the datasets which are named in capital letters/upcase on Unix?

I believe all sas data sets in unix flavors should be completely lower case.  So i wonder how you have upper case names or if these are really sas data sets?

It is possible if the datasets were copied outside of SAS that Upper case names could happen.  If that is so, I think you may need to rename at the Unix level, like this "mv OLD.sas7bdat old.sas7bdat"

Can you provide an example of the full name of one that is not being copied by proc copy?

Super User
Super User
Posts: 6,502

Re: Can Libname statement read the datasets which are named in capital letters/upcase on Unix?

Unix requires the file names to be in lowercase.  If you created the files on Windows or manually changed the name to included mixed case then they will not be recognized.  Use an operating system command to fix the names.

Frequent Contributor
Posts: 129

Re: Can Libname statement read the datasets which are named in capital letters/upcase on Unix?

Splitting hairs here , Tom;-) But lowercase dataset file names is a SAS on Unix requirement, not Unix requirement.


Valued Guide
Posts: 3,208

Re: Can Libname statement read the datasets which are named in capital letters/upcase on Unix?

Very correct Larry... There are differences at OS levels with filenames.
- Windows ignores the case on file-names.  You can use either upper/lower case.

- Mainframe (the old 390 environment) knows only upper-case. everything is translated to that even as you typing lowercase

- Unix (and the a-likes Linux I/OS etc.) are using both cases and they are really different.

SAS has a lot of his origin (mainframe) still there eg the 8 limit naming convention PL/1 syntax style.

SAS is trying to be transparant on all of this types of machines/OS.  By that introduced weird behavior on that part of namings.

Coding hungarian style (mixed case) namings will bring you into troubles. For sure with handling (filetransfer os commands) outside SAS and sometimes (I experienced that) in SAS.      

---->-- ja karman --<-----
Super User
Super User
Posts: 6,502

Re: Can Libname statement read the datasets which are named in capital letters/upcase on Unix?

In Unix you can have two different files where the names differ only in the case of the letters. (A.txt and a.txt would be two different files).  In SAS, dataset names (and catalogs and other SAS objects that are stored as operating system files) are case insensitive (work.A is the same dataset as work.a).

To make these two conflicting things work together on Unix SAS uses file names that are in all lowercase to stores datasets (catalogs, index files, etc). Even if you reference the dataset with a physical name rather than the normal libref.memname syntax (data "MyFile"; ...) it will still create the file name in all lowercase.  And when looking for the datasets it will only look for lowercase names, hence your problem copying the datasets with uppercase file names.

Now if you want to read or write a text file or other non SAS format file on Unix then SAS uses the exact name you tell it to use.  So if you reference "A.txt" in one program and "a.txt" in another they are talking about two different files.

Respected Advisor
Posts: 4,663

Re: Can Libname statement read the datasets which are named in capital letters/upcase on Unix?

I'm curious, can you reference a mixed case dataset file with a literal name such as WORK.'MyFile'n on UNIX? - PG

PG
Super Contributor
Posts: 358

Re: Can Libname statement read the datasets which are named in capital letters/upcase on Unix?

If I remember correctly, the UNIX side of z/OS (OpenMVS?) you could create file names in mixed case.  Used to case me no end of problems because I was so used to having names only in upper case from my mainframe days.

Valued Guide
Posts: 3,208

Re: Can Libname statement read the datasets which are named in capital letters/upcase on Unix?

A littebit rusty bold old bigblue iron went to open-mvs in the mid 90's. LE Language environment being introduced.

Since then it is a schizophrenic OS having a Unix (Posix) Kernal with old MVS integrated. TSO can switch to Unix by IShell, SDSF is seeing BPXAS the Unix sessions. SAS is using that Unix part since V9 as primary Kernal (including hfs). Very visible with SAS/Connect.
By the way OS/2 did not surnive milo 2000 / euro 2002, however some have used it long after that. 

---->-- ja karman --<-----
Super Contributor
Posts: 358

Re: Can Libname statement read the datasets which are named in capital letters/upcase on Unix?

Nooooo!  OS/2 Lives!

next you will be telling me there is no Santa and Elvis is dead.....

Frequent Contributor
Posts: 129

Re: Can Libname statement read the datasets which are named in capital letters/upcase on Unix?

Good question.  In AIX 9.2, this behaves very weirdly.  I tested with three files -- test.sas7bdat, Test.sas7bdat and aTest.sas7bdat.  I used Unix 'cp' command to create the two non standard files.  I think best advice is to not muck with dataset names and let SAS handle moving from system to system if possible.

Here is log:

 

322 data test;

323 set sasuser.'aTest'n ;

ERROR: File SASUSER.ATEST.DATA does not exist.

324 run ;

NOTE: The SAS System stopped processing this step because of errors.

WARNING: The data set WORK.TEST may be incomplete. When this step was stopped there were 0 observations and 0 variables.

WARNING: Data set WORK.TEST was not replaced because this step was stopped.

NOTE: DATA statement used (Total process time):

real time 0.02 seconds

cpu time 0.00 seconds

 

325 data test;

326 set sasuser.'Test'n ;

327 run ;

NOTE: There were 49473 observations read from the data set SASUSER.TEST.

NOTE: The data set WORK.TEST has 49473 observations and 32 variables.

NOTE: DATA statement used (Total process time):

real time 0.12 seconds

cpu time 0.05 seconds

Valued Guide
Posts: 3,208

Re: Can Libname statement read the datasets which are named in capital letters/upcase on Unix?

Ask a Question
Discussion stats
  • 11 replies
  • 785 views
  • 10 likes
  • 6 in conversation