So I am currently importing multiple text files from an FTP server into a single dataset. Due to the nature of the text files, I have to manually define the column lengths and names. What I am unable to figure out is how do I store the filename as a variable and insert it as a column so that the data for each file has the corresponding file name. The FTP I am using in WinSCP, and the files are in a subdirectory, where the prefix of the file is constant, but the suffix is changed based off of the timestamp that it gets uploaded. Currently my code looks like this (generalized) filename in ftp 'SUBFOLDER/common_file_prefix.*' /* The suffix is a variable name that has the timestamp of when the data was uploaded*/
user = 'user'
password = 'password'
host = 'host'
mget debug;
DATA project_data;
INFILE IN TRUNCOVER;
INPUT
COL1 $0-10
...
COL 30 $500-550
RUN;
I tried to add a column at the end using FILE_NAME = fname but that did not work, I have also tried to use the FILENAME = option I haven't gotten it to work for me yet either.
... View more