Thank you both. Unfortunately I can get the desired result. I'll try to explain my issue better ! Using the data set below: Var1 Var2 Var3 Var4 Var5 HEADER ID_A 20230509 20231205 correction VOLLINES ID_A 20230509 08MAY23:22:00:00 0.0000 VOLLINES ID_A 20230509 08MAY23:22:15:00 0.0000 FIXLINE ID_A 20230509 20231205 50 HEADER ID_B 20220131 20221231 correction VOLLINES ID_B 20220131 01JAN22:22:00:00 0.0000 VOLLINES ID_B 20220131 01JAN22:22:15:00 0.0000 FIXLINE ID_B 20220131 20221231 150 If I run my initial code data _null_; set Mydataset ; by column2 ; fv=cats("MyDirectory",Var2,'.csv'); file csv filevar=fv dsd dlm=';' lrecl=32000 ; put (_all_) (+0); run; I get two csv's: Filename: ID_A HEADER ID_A 20230509 20231205 correction VOLLINES ID_A 20230509 08MAY23:22:00:00 0.0000 VOLLINES ID_A 20230509 08MAY23:22:15:00 0.0000 FIXLINE ID_A 20230509 20231205 50 Filename: ID_B HEADER ID_B 20220131 20221231 correction VOLLINES ID_B 20220131 01JAN22:22:00:00 0.0000 VOLLINES ID_B 20220131 01JAN22:22:15:00 0.0000 FIXLINE ID_B 20220131 20221231 150 Content wise, this is exactly the output I want, but my issue is in the naming of the file: The first one should be named ID_A_Header (or whatever other concatenation of the first line of the csv eg: ID_A_20230509_20231205_correction) Same goes for the second file. Any idea how I can achieve this result ? I tried changing the following line: fv=cats("MyDirectory",Var2,'.csv'); ==> fv=cats("MyDirectory",Var2,Var1,'.csv'); My csv the get split differently content wise. In this case I would have 6 files, one for each combination of Header, Vollines, Fixline and ID_A, ID_B. At this point I am a bit lost. Thank you again for your help, Nathan
... View more