BookmarkSubscribeRSS Feed
johnhanigosky
Calcite | Level 5


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!! Smiley Happy

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;

3 REPLIES 3
SASKiwi
PROC Star

Try enclosing your filename in quotes:

datafile="\\server\folder\file.txt"

Kurt_Bremser
Super User

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?

ballardw
Super User

You Server session may not appropriate permissions or mapping to see the source.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 3188 views
  • 0 likes
  • 4 in conversation