Hi,
I am trying to import a text file proc import in EG. The issue is that SAS isn't able to locate the the client machine where the file actually sits. I've tried the following code in Exhibit 1 using the server option, but I don't think that is vali in proc import. I also tried to import the file using infile (see Exhibit 2). Still uses referencing the location of the file so SAS knows where to point to. Any suggestions? Thank you so much!!
Exhibit1: proc import with server =
proc import
datafile=\\server\folder\file.txt
out=mydata
dbms=dlm replace;
delimiter='|';
getnames=yes;
datarow=2;
options validvarname=v7;
server=&_CLIENTMACHINE;
run;
Exihibit 2: Referencing file using infile
DATA myshared.FAZAL;
LENGTH
hicn $ 12
consumer_point_of_sale $ 18
agent_point_of_sale $ 1
LABEL
hicn = "HICN"
consumer_point_of_sale = "Consumer Point Of Sale"
agent_point_of_sale = "Agent Point Of Sale"
INFORMAT
hicn $CHAR12.
consumer_point_of_sale $CHAR18.
agent_point_of_sale $CHAR1.
INFILE &FILENAME
LRECL=339
ENCODING="LATIN1"
TERMSTR=CRLF
DLM='7F'x
MISSOVER
SERVER=&_CLIENTMACHINE
DSD ;
INPUT
hicn : $CHAR12.
consumer_point_of_sale : $CHAR18.
agent_point_of_sale : $CHAR1.
;
RUN;
If the file "sits" on another system than the one that runs SAS, you need one of many mechanisms to access files on the remote (remote from the POV of SAS) system:
- shared network volumes on file servers
- ftp/sftp
- direct share of volumes (eg with nfs)
- SAS/CONNECT if both machines have SAS installed and CONNECT is licensed
If you have separate systems, how do they communicate/share data?
You Server session may not appropriate permissions or mapping to see the source.
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.
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.