BookmarkSubscribeRSS Feed
AshokDatti
Calcite | Level 5

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?

11 REPLIES 11
LarryWorley
Fluorite | Level 6

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?

Tom
Super User Tom
Super User

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.

LarryWorley
Fluorite | Level 6

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


jakarman
Barite | Level 11

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 --<-----
Tom
Super User Tom
Super User

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.

PGStats
Opal | Level 21

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

PG
OS2Rules
Obsidian | Level 7

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.

jakarman
Barite | Level 11

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 --<-----
OS2Rules
Obsidian | Level 7

Nooooo!  OS/2 Lives!

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

LarryWorley
Fluorite | Level 6

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

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 11 replies
  • 2796 views
  • 10 likes
  • 6 in conversation