Hi guys, I'm trying to dynamically set the dataset name based on a variable (dtmMonthEndDate) input at the start of my procedure. My code looks like this: * Enter the month ;
%Let dtmMonthEndDate = Intnx('Month', '31Dec2015'd, 0, "End") ;
* Format = YYYYMM ;
%Let strMonth = Put(&dtmMonthEndDate., yymmn6.) ;
%Let Filename = Compress("TableName_"||Year(&dtmMonthEndDate.)||"_"||SubStr(&strMonth., 5, 2)) ;
Data Work.MyData ;
Merge
"&Filename."
(
Keep = Ref_ID Segment_00
In = a
)
Work.Table_1
(
Keep = _All_
In = x
) ;
If x ;
By Ref_ID ;
Run ; The table name should look like this: "TableName_2015_12", with the 2015 denoting the year and 12 the month. The variables are fine when using them in any other part of the step; for example, when puting the filename into a column, but when I try to use it for a dataset name, the compress function is causing errors. Does anyone know how to circumvent this problem? I've searched like mad online and come up short. Any help would be great. I'm using SAS EGP version 6.1. Let me know if you need any further info? Many thanks, Jamie
... View more