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

(Data Flux | Data Management Studio 2.7)

I have a Macro Variable set to the input folder that contains 5 files .

I created a Fixed width input node and set the filename to the variable

I then export all the files contents to a pipe delimited file.

 

I have 2 dilemmas

  1. Since this concatenates all the files into one export is there a way to concatenate the filename of each source to its record ?

  2. I need the date that is also part of the name to be parsed out and added as another column

 

end result is a single file with FILENAME, FILEDATE columns added to each record from the original files

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
VincentRejany
SAS Employee

Hi

 

In the advanced properties of the Fixed Width Input node, you can enable the option "FILENAME_FIELD" by entering a variable name, which will output the name of the file read.

For extracting the date, would recommend to use an expression node with something like this:

 

Considering file name is similar to "MyFile_180827.txt", 'NAME' is the variable name for File Name.

 

string dateFile

parse(NAME,'_',null,dateFile)
dateFile = replace(dateFile,'.txt','')

 

vincent

View solution in original post

1 REPLY 1
VincentRejany
SAS Employee

Hi

 

In the advanced properties of the Fixed Width Input node, you can enable the option "FILENAME_FIELD" by entering a variable name, which will output the name of the file read.

For extracting the date, would recommend to use an expression node with something like this:

 

Considering file name is similar to "MyFile_180827.txt", 'NAME' is the variable name for File Name.

 

string dateFile

parse(NAME,'_',null,dateFile)
dateFile = replace(dateFile,'.txt','')

 

vincent

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 819 views
  • 0 likes
  • 2 in conversation