SAS university edition: can't load data

Reply
Occasional Contributor
Posts: 5

SAS university edition: can't load data

I'm trying a simple proc import:

proc import out = test datafile = "/folders/myfolders/cchs05.dta";

run;

Which gives me an error message saying 'physical file does not exist, '/folders/myfolders/cchs05.dta'.

I know I set up myfolders correctly because my libname statement

libname testlib "/folders/myfolders";

works fine.

And I saved 'cchs05.dta' to myfolders.  In fact, I can see it from the SAS studio tab under my folders.

I've tried logging in and out.  And using a data step but my infile statement gives a similar error. 

Clearly, I'm missing something obvious but I really can't figure it out.

Any help would be greatly appreciated!

Thank you,

Lyming


SAS problem.PNG
Occasional Contributor
Posts: 6

Re: SAS university edition: can't load data

Could it be that SAS does not recognize the .DTA file extension? The following example appears online. Maybe it can help you, specifically the DBMS and DELIMITER options. I am sorry but I have only imported CSV and EXCEL files into SAS.

proc import datafile='c:\temp\tab.txt'

  out=class

  dbms=dlm

  replace;

  delimiter='09'x;

  datarow=5;

run;

Grand Advisor
Posts: 17,464

Re: SAS university edition: can't load data

Try making sure to specify a DBMS, so SAS know what type of file it's trying to import

Occasional Contributor
Posts: 6

Re: SAS university edition: can't load data


Perhaps this narrative regarding DBMS might help:

DBMS=identifier

specifies the type of data to import. You can import JMP files (DBMS=JMP) or delimited files. To import a tab-delimited file, specify TAB as the identifier. To import any other delimited file that does not end in .CSV, specify DLM as the identifier. For a comma-separated file with a .CSV extension, DBMS= is optional. The IMPORT procedure recognizes .CSV as an extension for a comma-separated file.

See:DBMS Identifiers Supported in Base SAS for more information about identifiers for this option.
Occasional Contributor
Posts: 5

Re: SAS university edition: can't load data

Thanks for the suggestions but I don't think that's it...I think it's something more fundamental.  I also have the data in .txt format but running a datastep with an infile statement gives the same error. 

(Also, the SAS documentation seems to say '.dta' is not recognized as a DMBS identifier.)

Grand Advisor
Posts: 17,464

Re: SAS university edition: can't load data

1. restart UE

2. post code/ log from text version that failed.

Grand Advisor
Posts: 10,251

Re: SAS university edition: can't load data

You say this works fine:

libname testlib "/folders/myfolders";

Does this generate any error (test creating a data set)?

data testlib.test;

     x=1;

     output;

run;

(a basic test to see if you can write to that location)


Occasional Contributor
Posts: 5

Re: SAS university edition: can't load data

Thanks again for the suggestions.

The test dataset worked for the library...but nothing else.  I've included a log file below.

Here are the first 5 rows of a dataset in /folders/myfolders/

1 21213  293.76

1 38122  743.82

1 55113 2984.93

1 40111  975.96

1 40114  387.17

SAStestlog1.JPGSAStestlog2.JPG

Grand Advisor
Posts: 17,464

Re: SAS university edition: can't load data

What happens with either of the following code:

proc import datafile='/folders/myfolders/cchs05.dta'

  out=want

  dbms=dlm

  replace;

datarow=1;

  delimiter='09'x;

run;

or

data want;

infile '/folders/myfolders/cchs05.dta' dlm='09'x truncover firstobs=1;

input ID MRN VALUE;

run;

Esteemed Advisor
Posts: 6,726

Re: SAS university edition: can't load data

do the following:

filename oscmd pipe "ls -l /folders/myfolders 2>&1";

data _null_;

infile oscmd;

input;

put _infile_;

run;

This will write a complete directory listing of /folders/myfolders to the SAS log, including error messages if any happen (that is done by the 2>&1 redirection). You may get a clue out of that.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 5

Re: SAS university edition: can't load data

Thanks so much for the continued suggestions.

Reeza, I tried you two pieces of codes and both gave errors saying 'physical file does not exist'.

Kurt, the filename statement gave this:

filename.JPG

and then the data step didn't work

data.JPG

Grand Advisor
Posts: 17,464

Re: SAS university edition: can't load data

After examine my install of SAS UE, I think SAS is correct and your file is located else where.

If I saved a file under folder/myfolders location it shows under the second myfolders in the image you've included. Yours does not.

You've created a folder shortcut with the same name, but it may not reference the same location.

Examine your Shared Folder and determine where folders/myfolders is set to. Check if the file is actually in that location.

Occasional Contributor
Posts: 5

Re: SAS university edition: can't load data

That's it!  I didn't set folders/myfolders correctly - I guess because it's case sensitive? 

Anyway, it's working now.  Thanks again for all the help!

Lyming

Esteemed Advisor
Posts: 6,726

Re: SAS university edition: can't load data

Keep in mind that SAS UE runs on an VM with Linux, and Linux, as any UNIX, is completely case sensitive.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 13 replies
  • 1654 views
  • 1 like
  • 5 in conversation