Help using Base SAS procedures

import an undifine-name file

Reply
Regular Contributor
Posts: 222

import an undifine-name file

Hello everyone!

When I try to  import a .txt file into SAS,I just know the partial characters of the file's name, that means I don't know the full name of the file.

I know the .txt file's name start with "my_txt". and location is c:\myfile .

Could anyone tell me is that possible I can import the .txt file?

data one;

infile "C:\myfile\my_txt???????.txt"; /*those ? denotes unknown characters*/

input x;

run;

Thanks!

Mike

Super User
Posts: 17,912

Re: import an undifine-name file

Will there be more than one file with that naming convention?
Have you tried a wildcard, * instead of multiple question marks?

Regular Contributor
Posts: 222

Re: import an undifine-name file

only one file whose name start with "my_txt"

and the multiple question mark is just for show you  that place missing lots of character,I don't know what to do with it.

Thanks

Super User
Posts: 17,912

Re: import an undifine-name file

Try the * then.

infile "C:\myfile\my_txt*.txt";

Regular Contributor
Posts: 222

Re: import an undifine-name file

Thanks!

It works well!

and if there were more than one file start with it, SAS can read them into one dataset .

Regular Contributor
Posts: 209

Re: import an undifine-name file

[ Edited ]

got you

Ask a Question
Discussion stats
  • 5 replies
  • 177 views
  • 3 likes
  • 3 in conversation