11-28-2017 07:36 AM - edited 11-28-2017 07:38 AM
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.
11-28-2017 07:58 AM
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.
11-28-2017 07:59 AM
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:
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.
11-28-2017 12:31 PM
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,
11-28-2017 01:34 PM
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.