- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Is there any SAS options or an easy way to read a file in proc import filename without accounting the case sensitivity.
Eg: I need to import a file using proc import from a user who place it in a unix folder.. It is possible that user name it like myfile.xlsx / Myfile.xlsx / MyFile.xlsx etc.... I would need my code to handle it instead of giving an ERROR like "Physical file does not exist"
I can always look for certain keywords in the file name and can pick it by writing detailed code, but wondering if there are any easy option that could just ignore the case of the filename?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
No.
You could ask the operating system to give you list of all of the files and then pick the one you think is the one you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Options no but code should work.
I would be tempted to pipe an LS command to populate a data set, create an uppercase value in a different variable and then match my expected value as uppercase to select the mixed case and place that into a macro variable. Either use options to get the path as part of the filename OR use a concatenation function to prefix the name with the proper string.
filename listing pipe 'ls' <options>; data names; infile listing; length name $ 200 ; input name; if upcase(name) = "The path and file I expect" then call symputx('sourcefile',name); run; proc import datafile="&sourcefile." out=lib.datasetname dbms=xlsx; <other options> ; run;
Been way to long since I did any work on a Unix (or other system) do know what the full syntax option might be for the listing command.
Do not use any option that would list the names as all upper or lower case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content