I have the following files which are generated daily from another system which is date and time stamped.
I have a SAS process which is required to read in these daily files.
I have set up a macro variable so that it creates the date with the last business day %let file_date_m = &file_date_yr.&file_date_mth.&file_date_day.;
As for the time, I would not know when it will be generated, my question is, how can I find the correct file for SAS to read in and can the time part be omitted ?
I would like to set up a macro variable like this (%let cdsfilename = "CDSALL0E_&file_date_m._&time.csv"n;) so that I can read in the correct file depending on the business day.
These files are being read in via PC Files Server.
Examples of the filenames:
Execution time may be your bigger concern.
You can create a fileref with the name and date stem and ignore the time part using OS filesystem wildcards. In window.
Filename Input "c:\path\CDSALL_20150810_*.csv"; or use in an infile statement directly.
I am a tad concerned about this:
as you show an _m that does not appear in your input file name examples. Also the "n makes me think you are attempting to make a SAS variable name as most external file operations.
If you show some of the code how your are attempting to use the filename macro variable we might be able to provide some additional details.
You may be able to use a wild card in a FILEREF. Consider the following example which create some files using the names you show and then reads the one from TODAY()-2.
Find more tutorials on the SAS Users YouTube channel.