0
votes

I have to put together a slide deck on PROC IMPORT for a school project. SAS documentation (http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#n18jyszn33umngn14czw2qfw7thc.htm) says that there are three required arguments:

  1. Datafile=
  2. Out=
  3. Table=

It goes on to say that DBMS is optional.

For my slide deck, I'm trying to use an example that involves a TABLE= argument. However, I keep getting an error about not being able to have a FILE= and TABLE= statements together. In fact, in going back to other code to import data to do homework, I've noticed that none of the code uses a TABLE= argument. Instead, there's always a DBMS= statement. For example:

proc import
datafile = "C:\Users\ccedie1\Downloads\survey1.csv"
out = Survey
DBMS=csv;
run;
proc print data=Survey;
run;

It's my understanding that there are many versions of SAS and that a separate license is required for something called SAS/ACCESS Interface. I suspect that the school's computers have this additional license/functionality because it's not requiring a TABLE= statement. In fact, I can get this code to work even without the DBMS statement.

Please let me know what concept(s) I'm missing here. I obviously want my deck to be accurate. If I can't create an example that uses the TABLE= statement, I need to be able to explain why I can't do it. For example, I would like to say something like, "While the SAS documentation lists TABLE= as a required argument, it's not required when using SAS 9.4 on campus because _____________."

I realize I may not have done the best job explaining the problem/issue so my apologies for that.

Thanks in advance for any help.

2

2 Answers

0
votes

The documentation is wrong. It should say something to the effect of "Table or Datafile required".

The import wizard in SAS 9.4 generates this code:

PROC IMPORT OUT= WORK.test 
            DATAFILE= "C:\Users\User\Desktop\Testing.csv" 
            DBMS=CSV REPLACE;
     GETNAMES=YES;
     DATAROW=2; 
RUN;

No table statement.

Good luck in your class.

0
votes

The vertical bar in this line of the page you linked

DATAFILE="filename" | TABLE="tablename"

normally means or. Basically they are using Backus-Naur form.

So that means that one of the options listed is required, but you get to choose which one to use.

So when reading from a format that is stored in a physical file you must use specify datafile=, but when reading from a remote database you must specify the table= option.

Note that you linked to the older documentation for SAS version 9.3 instead of the current documentation.