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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 657 views
  • 0 likes
  • 2 in conversation