Hi Experts,
I want to automat report to export as following txt format to particular location
abc_202401
abc_202402
abc_202403
abc_202404
........................
.......................
abc_202412
Populate macro variable &export_path without quotes to not end-up with double quoting in the file statement.
Details matter.
By "as following text" do you mean make a report that looks like that? Names of files?
By "particular location" do you mean text file folder location? Columns and rows in the text file?
Typically when asking about making a report you need to provide examples of the source data and the rules involved in making a report. Unfortunately an example doesn't provide much in the way of the rules needed.
You subject line also mentions "import". Import what? what kind of file or data? What type of variables and properties are needed?
Hi ballardw ,
i want automatic for 12 months
%macro export_files;
%do month=1 %to 12;
%let month_suffix = %sysfunc(putn(&month,z2.));
%let file_name = abc_2024&month_suffix..txt;
%let export_path = "/home/u35263349/My_Folder/export_classdatasett"; /* Specify your export path */
/* Your data step or procedure to create the dataset to be exported */
data _null_;
file "&export_path.\&file_name";
put "This is data for month &month_suffix.";
run;
%end;
%mend;
%export_files;
Populate macro variable &export_path without quotes to not end-up with double quoting in the file statement.
@pavank wrote:
Hi ballardw ,
i want automatic for 12 months
%macro export_files; %do month=1 %to 12; %let month_suffix = %sysfunc(putn(&month,z2.)); %let file_name = abc_2024&month_suffix..txt; %let export_path = "/home/u35263349/My_Folder/export_classdatasett"; /* Specify your export path */ /* Your data step or procedure to create the dataset to be exported */ data _null_; file "&export_path.\&file_name"; put "This is data for month &month_suffix."; run; %end; %mend; %export_files;
And what is wrong with this code? Please explain in detail. If there are errors in the log, please show us the log.
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.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.