BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
KrunalPatel
Calcite | Level 5

hi there,

i am using the following code to dynamically import the data:

it is working all right if my "tbl_in" is same as its defined i.e. upper case, but its not working it is in lower case i.e. "ver_voal_std.csv"

%let tbl_in = VER_VOAL_STD.csv;

PROC IMPORT datafile = "&FromLoc.&tbl_in."

                  OUT= %sysfunc(compress(&Prefix. &OutName.))

            DBMS=csv REPLACE;

                  getnames=yes;
RUN;

anybody can help me how can i fix that?

Thanks,

KP

1 ACCEPTED SOLUTION

Accepted Solutions
Amir
PROC Star

Hi,

You could try using the %upcase function when referencing the macro variable. E.g.:

PROC IMPORT datafile = "&FromLoc.%upcase(&tbl_in.)"

The periods (.) should also no longer be necessary.

Regards,

Amir.

View solution in original post

4 REPLIES 4
Amir
PROC Star

Hi,

You could try using the %upcase function when referencing the macro variable. E.g.:

PROC IMPORT datafile = "&FromLoc.%upcase(&tbl_in.)"

The periods (.) should also no longer be necessary.

Regards,

Amir.

Amir
PROC Star

Hi,

I just realised the ".csv" extension was lowercase, so perhaps that would have to be separate to the rest of the file name in another macro variable.

See what your testing reveals.

Regards,

Amir.

KrunalPatel
Calcite | Level 5

Hi Amir,

thanks a lot.

Its working using %upcase();

Thanks,

KP


Kurt_Bremser
Super User

If your SAS process runs on a UNIX platform, filenames (as everything else in UNIX) are case sensitive.

"VER_VOAL_STD.csv", "ver_voal_std.csv", "VER_VOAL_STD.CSV" and "ver_voal_std.CSV" are all different objects and can exist side by side. (Also "Ver_voal_std.csv", you get the idea)

Define a standard way to write filenames (all lower case preferred) to make life easier, but also make sure that the case-sensitiveness is kept throughout the process. Make no assumptions, but use names "as is".

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!

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