BookmarkSubscribeRSS Feed
mfaqueiroz
Fluorite | Level 6

Hello,

 

I searched through the internet, wherever I could find the answer. Here's my problem: I need to import a csv that is always chaging the name (isn't a piece of cake, I know :(,  but i cannot modify this process). It is possible to prompt the user to specify the file path?

 

Any help is greatly appreciated.

Thank you.
M
🙂

4 REPLIES 4
ChrisHemedinger
Community Manager

Within EG, you could specify a project prompt (see the EG online help about "Working with prompts").  You can create a simple text prompt, or a more specific "File selection" prompt.

 

prompt.png

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
RW9
Diamond | Level 26 RW9
Diamond | Level 26

If you can't change the name of the file = your import documentation is broken.  How will you be versioning the file, what is the traceability.

 

Aside from that there are prompts in EG:

http://support.sas.com/resources/papers/proceedings17/0818-2017.pdf

 

But if you can't fix down the naming, can you not just save the file in one directory on its own, that way you could just use a wildcard:

data want;
  infile ".../*.csv";
...
run;

Would save some hassle.

mfaqueiroz
Fluorite | Level 6

Hello,

Thank you for the answers!
I tried to do the prompt type File or directory, however  it does not access to my own pc, but rather access to the SAS Server. 
Do you know how can I do this?

 

Thanks in advance,

Mariana

 

ChrisHemedinger
Community Manager

You might not be able to get the "local" file dialog for that file browser.  You might need to settle for a simple text prompt (type in the value).  You can seed the value with a default that might work much of the time, depending how consistent the file locations are.

 

In order for the code that follows to be able to run, the file you select must be available to the SAS server.  So, selecting a local CSV file and then expecting a remote DATA step to process it -- that won't work.

 

If that's your situation, you can use the Data->Copy Files task (EG 7.13 and later) to copy a local file to a remote SAS and then import it. The Copy Files task accepts wildcards and macro variables, so you really can generalize it for different scenarios.  You would be doing the opposite of this: Export and download any file.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 4 replies
  • 3108 views
  • 1 like
  • 3 in conversation